/* -*-c++-*- OpenRTI - Copyright (C) 2009-2023 Mathias Froehlich
 *
 *
 * This file is part of OpenRTI.
 *
 * OpenRTI is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * OpenRTI is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with OpenRTI.  If not, see <http://www.gnu.org/licenses/>.
 *
 * This file is autogenerated by messagegen.py. Do not edit!
 *
 */


#include "TightBE1MessageEncoding.h"
#include "AbstractMessageEncoding.h"
#include "DecodeDataStream.h"
#include "EncodeDataStream.h"
#include "Export.h"
#include "Message.h"

namespace OpenRTI {

class OPENRTI_LOCAL TightBE1MessageEncoding::EncodeStream : public EncodeDataStream {
public:
  EncodeStream(VariableLengthData& variableLengthData, TightBE1MessageEncoding& messageEncoding) :
    EncodeDataStream(variableLengthData),
    _messageEncoding(messageEncoding)
  { }
  void writeCallbackModel(const CallbackModel& value)
  {
    switch (value) {
    case HLA_IMMEDIATE:
      writeUInt32Compressed(0);
      break;
    case HLA_EVOKED:
      writeUInt32Compressed(1);
      break;
    default:
      writeUInt32Compressed(2);
      break;
    }
  }

  void writeOrderType(const OrderType& value)
  {
    switch (value) {
    case RECEIVE:
      writeUInt32Compressed(0);
      break;
    case TIMESTAMP:
      writeUInt32Compressed(1);
      break;
    default:
      writeUInt32Compressed(2);
      break;
    }
  }

  void writeTransportationType(const TransportationType& value)
  {
    switch (value) {
    case RELIABLE:
      writeUInt32Compressed(0);
      break;
    case BEST_EFFORT:
      writeUInt32Compressed(1);
      break;
    default:
      writeUInt32Compressed(2);
      break;
    }
  }

  void writeSubscriptionType(const SubscriptionType& value)
  {
    switch (value) {
    case Unsubscribed:
      writeUInt32Compressed(0);
      break;
    case SubscribedPassive:
      writeUInt32Compressed(1);
      break;
    case SubscribedActive:
      writeUInt32Compressed(2);
      break;
    default:
      writeUInt32Compressed(3);
      break;
    }
  }

  void writePublicationType(const PublicationType& value)
  {
    switch (value) {
    case Unpublished:
      writeUInt32Compressed(0);
      break;
    case Published:
      writeUInt32Compressed(1);
      break;
    default:
      writeUInt32Compressed(2);
      break;
    }
  }

  void writeResignAction(const ResignAction& value)
  {
    switch (value) {
    case UNCONDITIONALLY_DIVEST_ATTRIBUTES:
      writeUInt32Compressed(0);
      break;
    case DELETE_OBJECTS:
      writeUInt32Compressed(1);
      break;
    case CANCEL_PENDING_OWNERSHIP_ACQUISITIONS:
      writeUInt32Compressed(2);
      break;
    case DELETE_OBJECTS_THEN_DIVEST:
      writeUInt32Compressed(3);
      break;
    case CANCEL_THEN_DELETE_THEN_DIVEST:
      writeUInt32Compressed(4);
      break;
    case NO_ACTION:
      writeUInt32Compressed(5);
      break;
    default:
      writeUInt32Compressed(6);
      break;
    }
  }

  void writeRestoreFailureReason(const RestoreFailureReason& value)
  {
    switch (value) {
    case RTI_UNABLE_TO_RESTORE:
      writeUInt32Compressed(0);
      break;
    case FEDERATE_REPORTED_FAILURE_DURING_RESTORE:
      writeUInt32Compressed(1);
      break;
    case FEDERATE_RESIGNED_DURING_RESTORE:
      writeUInt32Compressed(2);
      break;
    case RTI_DETECTED_FAILURE_DURING_RESTORE:
      writeUInt32Compressed(3);
      break;
    default:
      writeUInt32Compressed(4);
      break;
    }
  }

  void writeRestoreStatus(const RestoreStatus& value)
  {
    switch (value) {
    case NO_RESTORE_IN_PROGRESS:
      writeUInt32Compressed(0);
      break;
    case FEDERATE_RESTORE_REQUEST_PENDING:
      writeUInt32Compressed(1);
      break;
    case FEDERATE_WAITING_FOR_RESTORE_TO_BEGIN:
      writeUInt32Compressed(2);
      break;
    case FEDERATE_PREPARED_TO_RESTORE:
      writeUInt32Compressed(3);
      break;
    case FEDERATE_RESTORING:
      writeUInt32Compressed(4);
      break;
    case FEDERATE_WAITING_FOR_FEDERATION_TO_RESTORE:
      writeUInt32Compressed(5);
      break;
    default:
      writeUInt32Compressed(6);
      break;
    }
  }

  void writeSaveFailureReason(const SaveFailureReason& value)
  {
    switch (value) {
    case RTI_UNABLE_TO_SAVE:
      writeUInt32Compressed(0);
      break;
    case FEDERATE_REPORTED_FAILURE_DURING_SAVE:
      writeUInt32Compressed(1);
      break;
    case FEDERATE_RESIGNED_DURING_SAVE:
      writeUInt32Compressed(2);
      break;
    case RTI_DETECTED_FAILURE_DURING_SAVE:
      writeUInt32Compressed(3);
      break;
    case SAVE_TIME_CANNOT_BE_HONORED:
      writeUInt32Compressed(4);
      break;
    default:
      writeUInt32Compressed(5);
      break;
    }
  }

  void writeSaveStatus(const SaveStatus& value)
  {
    switch (value) {
    case NO_SAVE_IN_PROGRESS:
      writeUInt32Compressed(0);
      break;
    case FEDERATE_INSTRUCTED_TO_SAVE:
      writeUInt32Compressed(1);
      break;
    case FEDERATE_SAVING:
      writeUInt32Compressed(2);
      break;
    case FEDERATE_WAITING_FOR_FEDERATION_TO_SAVE:
      writeUInt32Compressed(3);
      break;
    default:
      writeUInt32Compressed(4);
      break;
    }
  }

  void writeServiceGroupIndicator(const ServiceGroupIndicator& value)
  {
    switch (value) {
    case FEDERATION_MANAGEMENT:
      writeUInt32Compressed(0);
      break;
    case DECLARATION_MANAGEMENT:
      writeUInt32Compressed(1);
      break;
    case OBJECT_MANAGEMENT:
      writeUInt32Compressed(2);
      break;
    case OWNERSHIP_MANAGEMENT:
      writeUInt32Compressed(3);
      break;
    case TIME_MANAGEMENT:
      writeUInt32Compressed(4);
      break;
    case DATA_DISTRIBUTION_MANAGEMENT:
      writeUInt32Compressed(5);
      break;
    case SUPPORT_SERVICES:
      writeUInt32Compressed(6);
      break;
    default:
      writeUInt32Compressed(7);
      break;
    }
  }

  void writeLowerBoundTimeStampCommitType(const LowerBoundTimeStampCommitType& value)
  {
    switch (value) {
    case TimeAdvanceCommit:
      writeUInt32Compressed(0);
      break;
    case NextMessageCommit:
      writeUInt32Compressed(1);
      break;
    case TimeAdvanceAndNextMessageCommit:
      writeUInt32Compressed(2);
      break;
    default:
      writeUInt32Compressed(3);
      break;
    }
  }

  void writeSwitchesType(const SwitchesType& value)
  {
    switch (value) {
    case InteractionRelevanceAdvisorySwitchesType:
      writeUInt32Compressed(0);
      break;
    case ObjectClassRelevanceAdvisorySwitchesType:
      writeUInt32Compressed(1);
      break;
    case AttributeRelevanceAdvisorySwitchesType:
      writeUInt32Compressed(2);
      break;
    case AttributeScopeAdvisorySwitchesType:
      writeUInt32Compressed(3);
      break;
    case AutoProvideSwitchesType:
      writeUInt32Compressed(4);
      break;
    case ConveyRegionDesignatorSetsSwitchesType:
      writeUInt32Compressed(5);
      break;
    case ServiceReportingSwitchesType:
      writeUInt32Compressed(6);
      break;
    default:
      writeUInt32Compressed(7);
      break;
    }
  }

  void writeBool(const bool& value)
  {
    writeBoolCompressed(value);
  }

  void writeString(const std::string& value)
  {
    writeSizeTCompressed(value.size());
    for (std::string::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeChar(*i);
    }
  }

  void writeUnsigned(const uint32_t& value)
  {
    writeUInt32Compressed(value);
  }

  void writeDouble(const double& value)
  {
    writeFloat64Compressed(value);
  }

  void writeFederationHandle(const FederationHandle& value)
  {
    writeUInt16Compressed(value);
  }

  void writeModuleHandle(const ModuleHandle& value)
  {
    writeUInt16Compressed(value);
  }

  void writeAttributeHandle(const AttributeHandle& value)
  {
    writeUInt32Compressed(value);
  }

  void writeDimensionHandle(const DimensionHandle& value)
  {
    writeUInt32Compressed(value);
  }

  void writeUpdateRateHandle(const UpdateRateHandle& value)
  {
    writeUInt32Compressed(value);
  }

  void writeObjectClassHandle(const ObjectClassHandle& value)
  {
    writeUInt32Compressed(value);
  }

  void writeObjectInstanceHandle(const ObjectInstanceHandle& value)
  {
    writeUInt32Compressed(value);
  }

  void writeInteractionClassHandle(const InteractionClassHandle& value)
  {
    writeUInt32Compressed(value);
  }

  void writeParameterHandle(const ParameterHandle& value)
  {
    writeUInt32Compressed(value);
  }

  void writeFederateHandle(const FederateHandle& value)
  {
    writeUInt32Compressed(value);
  }

  void writeSpaceHandle(const SpaceHandle& value)
  {
    writeUInt32Compressed(value);
  }

  void writeTransportationHandle(const TransportationHandle& value)
  {
    writeUInt8Compressed(value);
  }

  void writeOrderingHandle(const OrderingHandle& value)
  {
    writeUInt8Compressed(value);
  }

  void writeMessageRetractionHandle(const MessageRetractionHandle& value)
  {
    writeUInt64Compressed(value);
  }

  void writeRegionHandle(const RegionHandle& value)
  {
    writeUInt64Compressed(value);
  }

  void writeAttributeHandleVector(const AttributeHandleVector& value)
  {
    writeSizeTCompressed(value.size());
    for (AttributeHandleVector::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeAttributeHandle(*i);
    }
  }

  void writeFederateHandleVector(const FederateHandleVector& value)
  {
    writeSizeTCompressed(value.size());
    for (FederateHandleVector::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFederateHandle(*i);
    }
  }

  void writeParameterHandleVector(const ParameterHandleVector& value)
  {
    writeSizeTCompressed(value.size());
    for (ParameterHandleVector::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeParameterHandle(*i);
    }
  }

  void writeDimensionHandleVector(const DimensionHandleVector& value)
  {
    writeSizeTCompressed(value.size());
    for (DimensionHandleVector::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeDimensionHandle(*i);
    }
  }

  void writeDimensionHandleSet(const DimensionHandleSet& value)
  {
    writeSizeTCompressed(value.size());
    for (DimensionHandleSet::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeDimensionHandle(*i);
    }
  }

  void writeObjectInstanceHandleVector(const ObjectInstanceHandleVector& value)
  {
    writeSizeTCompressed(value.size());
    for (ObjectInstanceHandleVector::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeObjectInstanceHandle(*i);
    }
  }

  void writeRegionHandleVector(const RegionHandleVector& value)
  {
    writeSizeTCompressed(value.size());
    for (RegionHandleVector::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeRegionHandle(*i);
    }
  }

  void writeModuleHandleVector(const ModuleHandleVector& value)
  {
    writeSizeTCompressed(value.size());
    for (ModuleHandleVector::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeModuleHandle(*i);
    }
  }

  void writeStringVector(const StringVector& value)
  {
    writeSizeTCompressed(value.size());
    for (StringVector::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeString(*i);
    }
  }

  void writeStringSet(const StringSet& value)
  {
    writeSizeTCompressed(value.size());
    for (StringSet::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeString(*i);
    }
  }

  void writeVariableLengthData(const VariableLengthData& value)
  {
    writeSizeTCompressed(value.size());
    if (!value.empty())
      _messageEncoding.addWriteBuffer(value);
  }

  void writeFederateHandleBoolPair(const FederateHandleBoolPair& value)
  {
    writeFederateHandle(value.first);
    writeBool(value.second);
  }

  void writeFederateHandleBoolPairVector(const FederateHandleBoolPairVector& value)
  {
    writeSizeTCompressed(value.size());
    for (FederateHandleBoolPairVector::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFederateHandleBoolPair(*i);
    }
  }

  void writeRangeBoundsValue(const RangeBoundsValue& value)
  {
    writeUnsigned(value.getLowerBound());
    writeUnsigned(value.getUpperBound());
  }

  void writeDimensionHandleRangeBoundsValuePair(const DimensionHandleRangeBoundsValuePair& value)
  {
    writeDimensionHandle(value.first);
    writeRangeBoundsValue(value.second);
  }

  void writeRegionValue(const RegionValue& value)
  {
    writeSizeTCompressed(value.size());
    for (RegionValue::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeDimensionHandleRangeBoundsValuePair(*i);
    }
  }

  void writeRegionValueList(const RegionValueList& value)
  {
    writeSizeTCompressed(value.size());
    for (RegionValueList::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeRegionValue(*i);
    }
  }

  void writeRegionHandleDimensionHandleSetPair(const RegionHandleDimensionHandleSetPair& value)
  {
    writeRegionHandle(value.first);
    writeDimensionHandleSet(value.second);
  }

  void writeRegionHandleDimensionHandleSetPairVector(const RegionHandleDimensionHandleSetPairVector& value)
  {
    writeSizeTCompressed(value.size());
    for (RegionHandleDimensionHandleSetPairVector::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeRegionHandleDimensionHandleSetPair(*i);
    }
  }

  void writeRegionHandleSpaceHandlePair(const RegionHandleSpaceHandlePair& value)
  {
    writeRegionHandle(value.first);
    writeSpaceHandle(value.second);
  }

  void writeRegionHandleSpaceHandlePairVector(const RegionHandleSpaceHandlePairVector& value)
  {
    writeSizeTCompressed(value.size());
    for (RegionHandleSpaceHandlePairVector::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeRegionHandleSpaceHandlePair(*i);
    }
  }

  void writeRegionHandleRegionValuePair(const RegionHandleRegionValuePair& value)
  {
    writeRegionHandle(value.first);
    writeRegionValue(value.second);
  }

  void writeRegionHandleRegionValuePairVector(const RegionHandleRegionValuePairVector& value)
  {
    writeSizeTCompressed(value.size());
    for (RegionHandleRegionValuePairVector::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeRegionHandleRegionValuePair(*i);
    }
  }

  void writeInteractionClassHandleRegionValueListPair(const InteractionClassHandleRegionValueListPair& value)
  {
    writeInteractionClassHandle(value.first);
    writeRegionValueList(value.second);
  }

  void writeAttributeHandleRegionValueListPair(const AttributeHandleRegionValueListPair& value)
  {
    writeAttributeHandle(value.first);
    writeRegionValueList(value.second);
  }

  void writeAttributeState(const AttributeState& value)
  {
    writeAttributeHandle(value.getAttributeHandle());
  }

  void writeAttributeStateVector(const AttributeStateVector& value)
  {
    writeSizeTCompressed(value.size());
    for (AttributeStateVector::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeAttributeState(*i);
    }
  }

  void writeParameterValue(const ParameterValue& value)
  {
    writeParameterHandle(value.getParameterHandle());
    writeVariableLengthData(value.getValue());
  }

  void writeParameterValueVector(const ParameterValueVector& value)
  {
    writeSizeTCompressed(value.size());
    for (ParameterValueVector::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeParameterValue(*i);
    }
  }

  void writeAttributeValue(const AttributeValue& value)
  {
    writeAttributeHandle(value.getAttributeHandle());
    writeVariableLengthData(value.getValue());
  }

  void writeAttributeValueVector(const AttributeValueVector& value)
  {
    writeSizeTCompressed(value.size());
    for (AttributeValueVector::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeAttributeValue(*i);
    }
  }

  void writeFederateHandleSaveStatusPair(const FederateHandleSaveStatusPair& value)
  {
    writeFederateHandle(value.first);
    writeSaveStatus(value.second);
  }

  void writeFederateHandleSaveStatusPairVector(const FederateHandleSaveStatusPairVector& value)
  {
    writeSizeTCompressed(value.size());
    for (FederateHandleSaveStatusPairVector::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFederateHandleSaveStatusPair(*i);
    }
  }

  void writeFederateHandleRestoreStatusPair(const FederateHandleRestoreStatusPair& value)
  {
    writeFederateHandle(value.first);
    writeRestoreStatus(value.second);
  }

  void writeFederateHandleRestoreStatusPairVector(const FederateHandleRestoreStatusPairVector& value)
  {
    writeSizeTCompressed(value.size());
    for (FederateHandleRestoreStatusPairVector::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFederateHandleRestoreStatusPair(*i);
    }
  }

  void writeFederationExecutionInformation(const FederationExecutionInformation& value)
  {
    writeString(value.getFederationExecutionName());
    writeString(value.getLogicalTimeFactoryName());
  }

  void writeFederationExecutionInformationVector(const FederationExecutionInformationVector& value)
  {
    writeSizeTCompressed(value.size());
    for (FederationExecutionInformationVector::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFederationExecutionInformation(*i);
    }
  }

  void writeObjectInstanceHandleNamePair(const ObjectInstanceHandleNamePair& value)
  {
    writeObjectInstanceHandle(value.first);
    writeString(value.second);
  }

  void writeObjectInstanceHandleNamePairVector(const ObjectInstanceHandleNamePairVector& value)
  {
    writeSizeTCompressed(value.size());
    for (ObjectInstanceHandleNamePairVector::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeObjectInstanceHandleNamePair(*i);
    }
  }

  void writeCreateFederationExecutionResponseType(const CreateFederationExecutionResponseType& value)
  {
    switch (value) {
    case CreateFederationExecutionResponseSuccess:
      writeUInt32Compressed(0);
      break;
    case CreateFederationExecutionResponseFederationExecutionAlreadyExists:
      writeUInt32Compressed(1);
      break;
    case CreateFederationExecutionResponseCouldNotOpenFDD:
      writeUInt32Compressed(2);
      break;
    case CreateFederationExecutionResponseErrorReadingFDD:
      writeUInt32Compressed(3);
      break;
    case CreateFederationExecutionResponseCouldNotCreateLogicalTimeFactory:
      writeUInt32Compressed(4);
      break;
    case CreateFederationExecutionResponseInconsistentFDD:
      writeUInt32Compressed(5);
      break;
    case CreateFederationExecutionResponseRTIinternalError:
      writeUInt32Compressed(6);
      break;
    default:
      writeUInt32Compressed(7);
      break;
    }
  }

  void writeDestroyFederationExecutionResponseType(const DestroyFederationExecutionResponseType& value)
  {
    switch (value) {
    case DestroyFederationExecutionResponseSuccess:
      writeUInt32Compressed(0);
      break;
    case DestroyFederationExecutionResponseFederatesCurrentlyJoined:
      writeUInt32Compressed(1);
      break;
    case DestroyFederationExecutionResponseFederationExecutionDoesNotExist:
      writeUInt32Compressed(2);
      break;
    case DestroyFederationExecutionResponseRTIinternalError:
      writeUInt32Compressed(3);
      break;
    default:
      writeUInt32Compressed(4);
      break;
    }
  }

  void writeJoinFederationExecutionResponseType(const JoinFederationExecutionResponseType& value)
  {
    switch (value) {
    case JoinFederationExecutionResponseSuccess:
      writeUInt32Compressed(0);
      break;
    case JoinFederationExecutionResponseFederateNameAlreadyInUse:
      writeUInt32Compressed(1);
      break;
    case JoinFederationExecutionResponseFederationExecutionDoesNotExist:
      writeUInt32Compressed(2);
      break;
    case JoinFederationExecutionResponseSaveInProgress:
      writeUInt32Compressed(3);
      break;
    case JoinFederationExecutionResponseRestoreInProgress:
      writeUInt32Compressed(4);
      break;
    case JoinFederationExecutionResponseInconsistentFDD:
      writeUInt32Compressed(5);
      break;
    default:
      writeUInt32Compressed(6);
      break;
    }
  }

  void writeRegisterFederationSynchronizationPointResponseType(const RegisterFederationSynchronizationPointResponseType& value)
  {
    switch (value) {
    case RegisterFederationSynchronizationPointResponseSuccess:
      writeUInt32Compressed(0);
      break;
    case RegisterFederationSynchronizationPointResponseLabelNotUnique:
      writeUInt32Compressed(1);
      break;
    case RegisterFederationSynchronizationPointResponseMemberNotJoined:
      writeUInt32Compressed(2);
      break;
    default:
      writeUInt32Compressed(3);
      break;
    }
  }

  void writeConfigurationParameterMap(const ConfigurationParameterMap& value)
  {
    writeSizeTCompressed(value.size());
    for (ConfigurationParameterMap::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeString(i->first);
      writeStringVector(i->second);
    }
  }

  void writeFOMStringTransportationType(const FOMStringTransportationType& value)
  {
    writeString(value.getName());
  }

  void writeFOMStringTransportationTypeList(const FOMStringTransportationTypeList& value)
  {
    writeSizeTCompressed(value.size());
    for (FOMStringTransportationTypeList::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFOMStringTransportationType(*i);
    }
  }

  void writeFOMStringDimension(const FOMStringDimension& value)
  {
    writeString(value.getName());
    writeUnsigned(value.getUpperBound());
  }

  void writeFOMStringDimensionList(const FOMStringDimensionList& value)
  {
    writeSizeTCompressed(value.size());
    for (FOMStringDimensionList::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFOMStringDimension(*i);
    }
  }

  void writeFOMStringRoutingSpace(const FOMStringRoutingSpace& value)
  {
    writeString(value.getName());
    writeStringSet(value.getDimensionSet());
  }

  void writeFOMStringRoutingSpaceList(const FOMStringRoutingSpaceList& value)
  {
    writeSizeTCompressed(value.size());
    for (FOMStringRoutingSpaceList::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFOMStringRoutingSpace(*i);
    }
  }

  void writeFOMStringParameter(const FOMStringParameter& value)
  {
    writeString(value.getName());
  }

  void writeFOMStringParameterList(const FOMStringParameterList& value)
  {
    writeSizeTCompressed(value.size());
    for (FOMStringParameterList::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFOMStringParameter(*i);
    }
  }

  void writeFOMStringInteractionClass(const FOMStringInteractionClass& value)
  {
    writeStringVector(value.getName());
    writeString(value.getOrderType());
    writeString(value.getTransportationType());
    writeString(value.getRoutingSpace());
    writeStringSet(value.getDimensionSet());
    writeFOMStringParameterList(value.getParameterList());
  }

  void writeFOMStringInteractionClassList(const FOMStringInteractionClassList& value)
  {
    writeSizeTCompressed(value.size());
    for (FOMStringInteractionClassList::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFOMStringInteractionClass(*i);
    }
  }

  void writeFOMStringAttribute(const FOMStringAttribute& value)
  {
    writeString(value.getName());
    writeString(value.getOrderType());
    writeString(value.getTransportationType());
    writeString(value.getRoutingSpace());
    writeStringSet(value.getDimensionSet());
  }

  void writeFOMStringAttributeList(const FOMStringAttributeList& value)
  {
    writeSizeTCompressed(value.size());
    for (FOMStringAttributeList::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFOMStringAttribute(*i);
    }
  }

  void writeFOMStringObjectClass(const FOMStringObjectClass& value)
  {
    writeStringVector(value.getName());
    writeFOMStringAttributeList(value.getAttributeList());
  }

  void writeFOMStringObjectClassList(const FOMStringObjectClassList& value)
  {
    writeSizeTCompressed(value.size());
    for (FOMStringObjectClassList::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFOMStringObjectClass(*i);
    }
  }

  void writeFOMStringUpdateRate(const FOMStringUpdateRate& value)
  {
    writeString(value.getName());
    writeDouble(value.getRate());
  }

  void writeFOMStringUpdateRateList(const FOMStringUpdateRateList& value)
  {
    writeSizeTCompressed(value.size());
    for (FOMStringUpdateRateList::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFOMStringUpdateRate(*i);
    }
  }

  void writeFOMStringSwitch(const FOMStringSwitch& value)
  {
    writeSwitchesType(value.getSwitchesType());
    writeBool(value.getEnabled());
  }

  void writeFOMStringSwitchList(const FOMStringSwitchList& value)
  {
    writeSizeTCompressed(value.size());
    for (FOMStringSwitchList::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFOMStringSwitch(*i);
    }
  }

  void writeFOMStringModule(const FOMStringModule& value)
  {
    writeString(value.getContent());
    writeFOMStringTransportationTypeList(value.getTransportationTypeList());
    writeFOMStringDimensionList(value.getDimensionList());
    writeFOMStringRoutingSpaceList(value.getRoutingSpaceList());
    writeFOMStringInteractionClassList(value.getInteractionClassList());
    writeFOMStringObjectClassList(value.getObjectClassList());
    writeFOMStringUpdateRateList(value.getUpdateRateList());
    writeFOMStringSwitchList(value.getSwitchList());
    writeBool(value.getArtificialInteractionRoot());
    writeBool(value.getArtificialObjectRoot());
  }

  void writeFOMStringModuleList(const FOMStringModuleList& value)
  {
    writeSizeTCompressed(value.size());
    for (FOMStringModuleList::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFOMStringModule(*i);
    }
  }

  void writeFOMTransportationType(const FOMTransportationType& value)
  {
    writeString(value.getName());
    writeTransportationType(value.getTransportationType());
  }

  void writeFOMTransportationTypeList(const FOMTransportationTypeList& value)
  {
    writeSizeTCompressed(value.size());
    for (FOMTransportationTypeList::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFOMTransportationType(*i);
    }
  }

  void writeFOMDimension(const FOMDimension& value)
  {
    writeString(value.getName());
    writeDimensionHandle(value.getDimensionHandle());
    writeUnsigned(value.getUpperBound());
  }

  void writeFOMDimensionList(const FOMDimensionList& value)
  {
    writeSizeTCompressed(value.size());
    for (FOMDimensionList::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFOMDimension(*i);
    }
  }

  void writeFOMRoutingSpace(const FOMRoutingSpace& value)
  {
    writeString(value.getName());
    writeSpaceHandle(value.getSpaceHandle());
    writeDimensionHandleSet(value.getDimensionHandleSet());
  }

  void writeFOMRoutingSpaceList(const FOMRoutingSpaceList& value)
  {
    writeSizeTCompressed(value.size());
    for (FOMRoutingSpaceList::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFOMRoutingSpace(*i);
    }
  }

  void writeFOMParameter(const FOMParameter& value)
  {
    writeString(value.getName());
    writeParameterHandle(value.getParameterHandle());
  }

  void writeFOMParameterList(const FOMParameterList& value)
  {
    writeSizeTCompressed(value.size());
    for (FOMParameterList::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFOMParameter(*i);
    }
  }

  void writeFOMInteractionClass(const FOMInteractionClass& value)
  {
    writeString(value.getName());
    writeInteractionClassHandle(value.getInteractionClassHandle());
    writeInteractionClassHandle(value.getParentInteractionClassHandle());
    writeOrderType(value.getOrderType());
    writeTransportationType(value.getTransportationType());
    writeDimensionHandleSet(value.getDimensionHandleSet());
    writeFOMParameterList(value.getParameterList());
  }

  void writeFOMInteractionClassList(const FOMInteractionClassList& value)
  {
    writeSizeTCompressed(value.size());
    for (FOMInteractionClassList::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFOMInteractionClass(*i);
    }
  }

  void writeFOMAttribute(const FOMAttribute& value)
  {
    writeString(value.getName());
    writeAttributeHandle(value.getAttributeHandle());
    writeOrderType(value.getOrderType());
    writeTransportationType(value.getTransportationType());
    writeDimensionHandleSet(value.getDimensionHandleSet());
  }

  void writeFOMAttributeList(const FOMAttributeList& value)
  {
    writeSizeTCompressed(value.size());
    for (FOMAttributeList::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFOMAttribute(*i);
    }
  }

  void writeFOMObjectClass(const FOMObjectClass& value)
  {
    writeString(value.getName());
    writeObjectClassHandle(value.getObjectClassHandle());
    writeObjectClassHandle(value.getParentObjectClassHandle());
    writeFOMAttributeList(value.getAttributeList());
  }

  void writeFOMObjectClassList(const FOMObjectClassList& value)
  {
    writeSizeTCompressed(value.size());
    for (FOMObjectClassList::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFOMObjectClass(*i);
    }
  }

  void writeFOMUpdateRate(const FOMUpdateRate& value)
  {
    writeString(value.getName());
    writeUpdateRateHandle(value.getUpdateRateHandle());
    writeDouble(value.getRate());
  }

  void writeFOMUpdateRateList(const FOMUpdateRateList& value)
  {
    writeSizeTCompressed(value.size());
    for (FOMUpdateRateList::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFOMUpdateRate(*i);
    }
  }

  void writeFOMSwitch(const FOMSwitch& value)
  {
    writeSwitchesType(value.getSwitchesType());
    writeBool(value.getEnabled());
  }

  void writeFOMSwitchList(const FOMSwitchList& value)
  {
    writeSizeTCompressed(value.size());
    for (FOMSwitchList::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFOMSwitch(*i);
    }
  }

  void writeFOMModule(const FOMModule& value)
  {
    writeModuleHandle(value.getModuleHandle());
    writeFOMTransportationTypeList(value.getTransportationTypeList());
    writeFOMDimensionList(value.getDimensionList());
    writeFOMRoutingSpaceList(value.getRoutingSpaceList());
    writeFOMInteractionClassList(value.getInteractionClassList());
    writeFOMObjectClassList(value.getObjectClassList());
    writeFOMUpdateRateList(value.getUpdateRateList());
    writeFOMSwitchList(value.getSwitchList());
    writeBool(value.getArtificialInteractionRoot());
    writeBool(value.getArtificialObjectRoot());
    writeString(value.getContent());
  }

  void writeFOMModuleList(const FOMModuleList& value)
  {
    writeSizeTCompressed(value.size());
    for (FOMModuleList::const_iterator i = value.begin(); i != value.end(); ++i) {
      writeFOMModule(*i);
    }
  }

  void writeConnectionLostMessage(const ConnectionLostMessage& value)
  {
    writeString(value.getFaultDescription());
  }

  void writeCreateFederationExecutionRequestMessage(const CreateFederationExecutionRequestMessage& value)
  {
    writeString(value.getFederationExecution());
    writeString(value.getLogicalTimeFactoryName());
    writeFOMStringModuleList(value.getFOMStringModuleList());
  }

  void writeCreateFederationExecutionResponseMessage(const CreateFederationExecutionResponseMessage& value)
  {
    writeCreateFederationExecutionResponseType(value.getCreateFederationExecutionResponseType());
    writeString(value.getExceptionString());
  }

  void writeDestroyFederationExecutionRequestMessage(const DestroyFederationExecutionRequestMessage& value)
  {
    writeString(value.getFederationExecution());
  }

  void writeDestroyFederationExecutionResponseMessage(const DestroyFederationExecutionResponseMessage& value)
  {
    writeDestroyFederationExecutionResponseType(value.getDestroyFederationExecutionResponseType());
  }

  void writeEnumerateFederationExecutionsRequestMessage(const EnumerateFederationExecutionsRequestMessage& value)
  {
  }

  void writeEnumerateFederationExecutionsResponseMessage(const EnumerateFederationExecutionsResponseMessage& value)
  {
    writeFederationExecutionInformationVector(value.getFederationExecutionInformationVector());
  }

  void writeInsertFederationExecutionMessage(const InsertFederationExecutionMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeString(value.getFederationName());
    writeString(value.getLogicalTimeFactoryName());
    writeConfigurationParameterMap(value.getConfigurationParameterMap());
  }

  void writeShutdownFederationExecutionMessage(const ShutdownFederationExecutionMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
  }

  void writeEraseFederationExecutionMessage(const EraseFederationExecutionMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
  }

  void writeReleaseFederationHandleMessage(const ReleaseFederationHandleMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
  }

  void writeInsertModulesMessage(const InsertModulesMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFOMModuleList(value.getFOMModuleList());
  }

  void writeJoinFederationExecutionRequestMessage(const JoinFederationExecutionRequestMessage& value)
  {
    writeString(value.getFederationExecution());
    writeString(value.getFederateType());
    writeString(value.getFederateName());
    writeFOMStringModuleList(value.getFOMStringModuleList());
    writeConfigurationParameterMap(value.getConfigurationParameterMap());
  }

  void writeJoinFederationExecutionResponseMessage(const JoinFederationExecutionResponseMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeJoinFederationExecutionResponseType(value.getJoinFederationExecutionResponseType());
    writeString(value.getExceptionString());
    writeFederateHandle(value.getFederateHandle());
    writeString(value.getFederateType());
    writeString(value.getFederateName());
  }

  void writeResignFederationExecutionLeafRequestMessage(const ResignFederationExecutionLeafRequestMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getFederateHandle());
    writeResignAction(value.getResignAction());
  }

  void writeResignFederationExecutionRequestMessage(const ResignFederationExecutionRequestMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getFederateHandle());
  }

  void writeJoinFederateNotifyMessage(const JoinFederateNotifyMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getFederateHandle());
    writeString(value.getFederateType());
    writeString(value.getFederateName());
  }

  void writeResignFederateNotifyMessage(const ResignFederateNotifyMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getFederateHandle());
  }

  void writeChangeAutomaticResignDirectiveMessage(const ChangeAutomaticResignDirectiveMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getFederateHandle());
    writeResignAction(value.getResignAction());
  }

  void writeRegisterFederationSynchronizationPointMessage(const RegisterFederationSynchronizationPointMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getFederateHandle());
    writeString(value.getLabel());
    writeVariableLengthData(value.getTag());
    writeFederateHandleVector(value.getFederateHandleVector());
  }

  void writeRegisterFederationSynchronizationPointResponseMessage(const RegisterFederationSynchronizationPointResponseMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getFederateHandle());
    writeString(value.getLabel());
    writeRegisterFederationSynchronizationPointResponseType(value.getRegisterFederationSynchronizationPointResponseType());
  }

  void writeAnnounceSynchronizationPointMessage(const AnnounceSynchronizationPointMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeString(value.getLabel());
    writeVariableLengthData(value.getTag());
    writeBool(value.getAddJoiningFederates());
    writeFederateHandleVector(value.getFederateHandleVector());
  }

  void writeSynchronizationPointAchievedMessage(const SynchronizationPointAchievedMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeString(value.getLabel());
    writeFederateHandleBoolPairVector(value.getFederateHandleBoolPairVector());
  }

  void writeFederationSynchronizedMessage(const FederationSynchronizedMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeString(value.getLabel());
    writeFederateHandleBoolPairVector(value.getFederateHandleBoolPairVector());
  }

  void writeEnableTimeRegulationRequestMessage(const EnableTimeRegulationRequestMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getFederateHandle());
    writeVariableLengthData(value.getTimeStamp());
    writeUnsigned(value.getCommitId());
  }

  void writeEnableTimeRegulationResponseMessage(const EnableTimeRegulationResponseMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getFederateHandle());
    writeFederateHandle(value.getRespondingFederateHandle());
    writeBool(value.getTimeStampValid());
    writeVariableLengthData(value.getTimeStamp());
  }

  void writeDisableTimeRegulationRequestMessage(const DisableTimeRegulationRequestMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getFederateHandle());
  }

  void writeCommitLowerBoundTimeStampMessage(const CommitLowerBoundTimeStampMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getFederateHandle());
    writeVariableLengthData(value.getTimeStamp());
    writeLowerBoundTimeStampCommitType(value.getCommitType());
    writeUnsigned(value.getCommitId());
  }

  void writeCommitLowerBoundTimeStampResponseMessage(const CommitLowerBoundTimeStampResponseMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getFederateHandle());
    writeFederateHandle(value.getSendingFederateHandle());
    writeUnsigned(value.getCommitId());
  }

  void writeLockedByNextMessageRequestMessage(const LockedByNextMessageRequestMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getSendingFederateHandle());
    writeBool(value.getLockedByNextMessage());
  }

  void writeTimeConstrainedEnabledMessage(const TimeConstrainedEnabledMessage& value)
  {
  }

  void writeTimeRegulationEnabledMessage(const TimeRegulationEnabledMessage& value)
  {
  }

  void writeTimeAdvanceGrantedMessage(const TimeAdvanceGrantedMessage& value)
  {
  }

  void writeInsertRegionMessage(const InsertRegionMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeRegionHandleDimensionHandleSetPairVector(value.getRegionHandleDimensionHandleSetPairVector());
  }

  void writeCommitRegionMessage(const CommitRegionMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeRegionHandleRegionValuePairVector(value.getRegionHandleRegionValuePairVector());
  }

  void writeEraseRegionMessage(const EraseRegionMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeRegionHandleVector(value.getRegionHandleVector());
  }

  void writeChangeInteractionClassPublicationMessage(const ChangeInteractionClassPublicationMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writePublicationType(value.getPublicationType());
    writeInteractionClassHandle(value.getInteractionClassHandle());
  }

  void writeChangeObjectClassPublicationMessage(const ChangeObjectClassPublicationMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writePublicationType(value.getPublicationType());
    writeObjectClassHandle(value.getObjectClassHandle());
    writeAttributeHandleVector(value.getAttributeHandles());
  }

  void writeChangeInteractionClassSubscriptionMessage(const ChangeInteractionClassSubscriptionMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeSubscriptionType(value.getSubscriptionType());
    writeInteractionClassHandle(value.getInteractionClassHandle());
  }

  void writeChangeObjectClassSubscriptionMessage(const ChangeObjectClassSubscriptionMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeSubscriptionType(value.getSubscriptionType());
    writeObjectClassHandle(value.getObjectClassHandle());
    writeAttributeHandleVector(value.getAttributeHandles());
  }

  void writeRegistrationForObjectClassMessage(const RegistrationForObjectClassMessage& value)
  {
    writeObjectClassHandle(value.getObjectClassHandle());
    writeBool(value.getStart());
  }

  void writeAttributesInScopeMessage(const AttributesInScopeMessage& value)
  {
    writeObjectInstanceHandle(value.getObjectInstanceHandle());
    writeAttributeHandleVector(value.getAttributeHandles());
    writeBool(value.getInScope());
  }

  void writeTurnUpdatesOnForInstanceMessage(const TurnUpdatesOnForInstanceMessage& value)
  {
    writeObjectInstanceHandle(value.getObjectInstanceHandle());
    writeAttributeHandleVector(value.getAttributeHandles());
    writeString(value.getUpdateRate());
    writeBool(value.getOn());
  }

  void writeTurnInteractionsOnMessage(const TurnInteractionsOnMessage& value)
  {
    writeInteractionClassHandle(value.getInteractionClassHandle());
    writeBool(value.getOn());
  }

  void writeInteractionMessage(const InteractionMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getFederateHandle());
    writeInteractionClassHandle(value.getInteractionClassHandle());
    writeTransportationType(value.getTransportationType());
    writeVariableLengthData(value.getTag());
    writeParameterValueVector(value.getParameterValues());
  }

  void writeTimeStampedInteractionMessage(const TimeStampedInteractionMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getFederateHandle());
    writeInteractionClassHandle(value.getInteractionClassHandle());
    writeOrderType(value.getOrderType());
    writeTransportationType(value.getTransportationType());
    writeVariableLengthData(value.getTag());
    writeVariableLengthData(value.getTimeStamp());
    writeMessageRetractionHandle(value.getMessageRetractionHandle());
    writeParameterValueVector(value.getParameterValues());
  }

  void writeObjectInstanceHandlesRequestMessage(const ObjectInstanceHandlesRequestMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getFederateHandle());
    writeUnsigned(value.getCount());
  }

  void writeObjectInstanceHandlesResponseMessage(const ObjectInstanceHandlesResponseMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getFederateHandle());
    writeObjectInstanceHandleNamePairVector(value.getObjectInstanceHandleNamePairVector());
  }

  void writeReleaseMultipleObjectInstanceNameHandlePairsMessage(const ReleaseMultipleObjectInstanceNameHandlePairsMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeObjectInstanceHandleVector(value.getObjectInstanceHandleVector());
  }

  void writeReserveObjectInstanceNameRequestMessage(const ReserveObjectInstanceNameRequestMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getFederateHandle());
    writeString(value.getName());
  }

  void writeReserveObjectInstanceNameResponseMessage(const ReserveObjectInstanceNameResponseMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getFederateHandle());
    writeObjectInstanceHandleNamePair(value.getObjectInstanceHandleNamePair());
    writeBool(value.getSuccess());
  }

  void writeReserveMultipleObjectInstanceNameRequestMessage(const ReserveMultipleObjectInstanceNameRequestMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getFederateHandle());
    writeStringVector(value.getNameList());
  }

  void writeReserveMultipleObjectInstanceNameResponseMessage(const ReserveMultipleObjectInstanceNameResponseMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getFederateHandle());
    writeObjectInstanceHandleNamePairVector(value.getObjectInstanceHandleNamePairVector());
    writeBool(value.getSuccess());
  }

  void writeInsertObjectInstanceMessage(const InsertObjectInstanceMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeObjectClassHandle(value.getObjectClassHandle());
    writeObjectInstanceHandle(value.getObjectInstanceHandle());
    writeString(value.getName());
    writeAttributeStateVector(value.getAttributeStateVector());
  }

  void writeDeleteObjectInstanceMessage(const DeleteObjectInstanceMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getFederateHandle());
    writeObjectInstanceHandle(value.getObjectInstanceHandle());
    writeVariableLengthData(value.getTag());
  }

  void writeTimeStampedDeleteObjectInstanceMessage(const TimeStampedDeleteObjectInstanceMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getFederateHandle());
    writeObjectInstanceHandle(value.getObjectInstanceHandle());
    writeOrderType(value.getOrderType());
    writeVariableLengthData(value.getTag());
    writeVariableLengthData(value.getTimeStamp());
    writeMessageRetractionHandle(value.getMessageRetractionHandle());
  }

  void writeAttributeUpdateMessage(const AttributeUpdateMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getFederateHandle());
    writeObjectInstanceHandle(value.getObjectInstanceHandle());
    writeVariableLengthData(value.getTag());
    writeTransportationType(value.getTransportationType());
    writeAttributeValueVector(value.getAttributeValues());
  }

  void writeTimeStampedAttributeUpdateMessage(const TimeStampedAttributeUpdateMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeFederateHandle(value.getFederateHandle());
    writeObjectInstanceHandle(value.getObjectInstanceHandle());
    writeVariableLengthData(value.getTag());
    writeVariableLengthData(value.getTimeStamp());
    writeMessageRetractionHandle(value.getMessageRetractionHandle());
    writeOrderType(value.getOrderType());
    writeTransportationType(value.getTransportationType());
    writeAttributeValueVector(value.getAttributeValues());
  }

  void writeRequestAttributeUpdateMessage(const RequestAttributeUpdateMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeObjectInstanceHandle(value.getObjectInstanceHandle());
    writeAttributeHandleVector(value.getAttributeHandles());
    writeVariableLengthData(value.getTag());
  }

  void writeRequestClassAttributeUpdateMessage(const RequestClassAttributeUpdateMessage& value)
  {
    writeFederationHandle(value.getFederationHandle());
    writeObjectClassHandle(value.getObjectClassHandle());
    writeAttributeHandleVector(value.getAttributeHandles());
    writeVariableLengthData(value.getTag());
  }

  TightBE1MessageEncoding& _messageEncoding;
};

class OPENRTI_LOCAL TightBE1MessageEncoding::DispatchFunctor {
public:
  DispatchFunctor(TightBE1MessageEncoding& messageEncoding) :
    _messageEncoding(messageEncoding)
  { }

  template<typename M>
  void operator()(const M& message) const
  { encode(_messageEncoding, message); }

  void
  encode(TightBE1MessageEncoding&, const AbstractMessage&) const
  {
    throw RTIinternalError("Invalid message dispatched to encoding!");
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const ConnectionLostMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(1);
    encodeStream.writeConnectionLostMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const CreateFederationExecutionRequestMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(2);
    encodeStream.writeCreateFederationExecutionRequestMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const CreateFederationExecutionResponseMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(3);
    encodeStream.writeCreateFederationExecutionResponseMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const DestroyFederationExecutionRequestMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(4);
    encodeStream.writeDestroyFederationExecutionRequestMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const DestroyFederationExecutionResponseMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(5);
    encodeStream.writeDestroyFederationExecutionResponseMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const EnumerateFederationExecutionsRequestMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(6);
    encodeStream.writeEnumerateFederationExecutionsRequestMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const EnumerateFederationExecutionsResponseMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(7);
    encodeStream.writeEnumerateFederationExecutionsResponseMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const InsertFederationExecutionMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(8);
    encodeStream.writeInsertFederationExecutionMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const ShutdownFederationExecutionMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(9);
    encodeStream.writeShutdownFederationExecutionMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const EraseFederationExecutionMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(10);
    encodeStream.writeEraseFederationExecutionMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const ReleaseFederationHandleMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(11);
    encodeStream.writeReleaseFederationHandleMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const InsertModulesMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(12);
    encodeStream.writeInsertModulesMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const JoinFederationExecutionRequestMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(13);
    encodeStream.writeJoinFederationExecutionRequestMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const JoinFederationExecutionResponseMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(14);
    encodeStream.writeJoinFederationExecutionResponseMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const ResignFederationExecutionRequestMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(15);
    encodeStream.writeResignFederationExecutionRequestMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const JoinFederateNotifyMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(16);
    encodeStream.writeJoinFederateNotifyMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const ResignFederateNotifyMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(17);
    encodeStream.writeResignFederateNotifyMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const ChangeAutomaticResignDirectiveMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(18);
    encodeStream.writeChangeAutomaticResignDirectiveMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const RegisterFederationSynchronizationPointMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(30);
    encodeStream.writeRegisterFederationSynchronizationPointMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const RegisterFederationSynchronizationPointResponseMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(31);
    encodeStream.writeRegisterFederationSynchronizationPointResponseMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const AnnounceSynchronizationPointMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(32);
    encodeStream.writeAnnounceSynchronizationPointMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const SynchronizationPointAchievedMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(33);
    encodeStream.writeSynchronizationPointAchievedMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const FederationSynchronizedMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(34);
    encodeStream.writeFederationSynchronizedMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const EnableTimeRegulationRequestMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(40);
    encodeStream.writeEnableTimeRegulationRequestMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const EnableTimeRegulationResponseMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(41);
    encodeStream.writeEnableTimeRegulationResponseMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const DisableTimeRegulationRequestMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(42);
    encodeStream.writeDisableTimeRegulationRequestMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const CommitLowerBoundTimeStampMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(43);
    encodeStream.writeCommitLowerBoundTimeStampMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const CommitLowerBoundTimeStampResponseMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(44);
    encodeStream.writeCommitLowerBoundTimeStampResponseMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const LockedByNextMessageRequestMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(45);
    encodeStream.writeLockedByNextMessageRequestMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const InsertRegionMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(46);
    encodeStream.writeInsertRegionMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const CommitRegionMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(47);
    encodeStream.writeCommitRegionMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const EraseRegionMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(48);
    encodeStream.writeEraseRegionMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const ChangeInteractionClassPublicationMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(50);
    encodeStream.writeChangeInteractionClassPublicationMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const ChangeObjectClassPublicationMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(51);
    encodeStream.writeChangeObjectClassPublicationMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const ChangeInteractionClassSubscriptionMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(52);
    encodeStream.writeChangeInteractionClassSubscriptionMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const ChangeObjectClassSubscriptionMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(53);
    encodeStream.writeChangeObjectClassSubscriptionMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const InteractionMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(80);
    encodeStream.writeInteractionMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const TimeStampedInteractionMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(81);
    encodeStream.writeTimeStampedInteractionMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const ObjectInstanceHandlesRequestMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(60);
    encodeStream.writeObjectInstanceHandlesRequestMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const ObjectInstanceHandlesResponseMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(61);
    encodeStream.writeObjectInstanceHandlesResponseMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const ReleaseMultipleObjectInstanceNameHandlePairsMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(62);
    encodeStream.writeReleaseMultipleObjectInstanceNameHandlePairsMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const ReserveObjectInstanceNameRequestMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(63);
    encodeStream.writeReserveObjectInstanceNameRequestMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const ReserveObjectInstanceNameResponseMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(64);
    encodeStream.writeReserveObjectInstanceNameResponseMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const ReserveMultipleObjectInstanceNameRequestMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(65);
    encodeStream.writeReserveMultipleObjectInstanceNameRequestMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const ReserveMultipleObjectInstanceNameResponseMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(66);
    encodeStream.writeReserveMultipleObjectInstanceNameResponseMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const InsertObjectInstanceMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(90);
    encodeStream.writeInsertObjectInstanceMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const DeleteObjectInstanceMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(91);
    encodeStream.writeDeleteObjectInstanceMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const TimeStampedDeleteObjectInstanceMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(92);
    encodeStream.writeTimeStampedDeleteObjectInstanceMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const AttributeUpdateMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(94);
    encodeStream.writeAttributeUpdateMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const TimeStampedAttributeUpdateMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(96);
    encodeStream.writeTimeStampedAttributeUpdateMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const RequestAttributeUpdateMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(97);
    encodeStream.writeRequestAttributeUpdateMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

  void
  encode(TightBE1MessageEncoding& messageEncoding, const RequestClassAttributeUpdateMessage& message) const
  {
    EncodeDataStream headerStream(messageEncoding.addScratchWriteBuffer());
    EncodeStream encodeStream(messageEncoding.addScratchWriteBuffer(), messageEncoding);
    encodeStream.writeUInt16Compressed(98);
    encodeStream.writeRequestClassAttributeUpdateMessage(message);
    headerStream.writeUInt32BE(uint32_t(encodeStream.size()));
  }

private:
  TightBE1MessageEncoding& _messageEncoding;
};

class OPENRTI_LOCAL TightBE1MessageEncoding::DecodeStream : public DecodeDataStream {
public:
  DecodeStream(const VariableLengthData& variableLengthData, TightBE1MessageEncoding& messageEncoding) :
    DecodeDataStream(variableLengthData),
    _messageEncoding(messageEncoding)
  { }
  void readCallbackModel(CallbackModel& value)
  {
    switch (readUInt32Compressed()) {
    case 0:
      value = HLA_IMMEDIATE;
      break;
    case 1:
      value = HLA_EVOKED;
      break;
    default:
      value = HLA_EVOKED;
      break;
    }
  }

  void readOrderType(OrderType& value)
  {
    switch (readUInt32Compressed()) {
    case 0:
      value = RECEIVE;
      break;
    case 1:
      value = TIMESTAMP;
      break;
    default:
      value = TIMESTAMP;
      break;
    }
  }

  void readTransportationType(TransportationType& value)
  {
    switch (readUInt32Compressed()) {
    case 0:
      value = RELIABLE;
      break;
    case 1:
      value = BEST_EFFORT;
      break;
    default:
      value = BEST_EFFORT;
      break;
    }
  }

  void readSubscriptionType(SubscriptionType& value)
  {
    switch (readUInt32Compressed()) {
    case 0:
      value = Unsubscribed;
      break;
    case 1:
      value = SubscribedPassive;
      break;
    case 2:
      value = SubscribedActive;
      break;
    default:
      value = SubscribedActive;
      break;
    }
  }

  void readPublicationType(PublicationType& value)
  {
    switch (readUInt32Compressed()) {
    case 0:
      value = Unpublished;
      break;
    case 1:
      value = Published;
      break;
    default:
      value = Published;
      break;
    }
  }

  void readResignAction(ResignAction& value)
  {
    switch (readUInt32Compressed()) {
    case 0:
      value = UNCONDITIONALLY_DIVEST_ATTRIBUTES;
      break;
    case 1:
      value = DELETE_OBJECTS;
      break;
    case 2:
      value = CANCEL_PENDING_OWNERSHIP_ACQUISITIONS;
      break;
    case 3:
      value = DELETE_OBJECTS_THEN_DIVEST;
      break;
    case 4:
      value = CANCEL_THEN_DELETE_THEN_DIVEST;
      break;
    case 5:
      value = NO_ACTION;
      break;
    default:
      value = NO_ACTION;
      break;
    }
  }

  void readRestoreFailureReason(RestoreFailureReason& value)
  {
    switch (readUInt32Compressed()) {
    case 0:
      value = RTI_UNABLE_TO_RESTORE;
      break;
    case 1:
      value = FEDERATE_REPORTED_FAILURE_DURING_RESTORE;
      break;
    case 2:
      value = FEDERATE_RESIGNED_DURING_RESTORE;
      break;
    case 3:
      value = RTI_DETECTED_FAILURE_DURING_RESTORE;
      break;
    default:
      value = RTI_DETECTED_FAILURE_DURING_RESTORE;
      break;
    }
  }

  void readRestoreStatus(RestoreStatus& value)
  {
    switch (readUInt32Compressed()) {
    case 0:
      value = NO_RESTORE_IN_PROGRESS;
      break;
    case 1:
      value = FEDERATE_RESTORE_REQUEST_PENDING;
      break;
    case 2:
      value = FEDERATE_WAITING_FOR_RESTORE_TO_BEGIN;
      break;
    case 3:
      value = FEDERATE_PREPARED_TO_RESTORE;
      break;
    case 4:
      value = FEDERATE_RESTORING;
      break;
    case 5:
      value = FEDERATE_WAITING_FOR_FEDERATION_TO_RESTORE;
      break;
    default:
      value = FEDERATE_WAITING_FOR_FEDERATION_TO_RESTORE;
      break;
    }
  }

  void readSaveFailureReason(SaveFailureReason& value)
  {
    switch (readUInt32Compressed()) {
    case 0:
      value = RTI_UNABLE_TO_SAVE;
      break;
    case 1:
      value = FEDERATE_REPORTED_FAILURE_DURING_SAVE;
      break;
    case 2:
      value = FEDERATE_RESIGNED_DURING_SAVE;
      break;
    case 3:
      value = RTI_DETECTED_FAILURE_DURING_SAVE;
      break;
    case 4:
      value = SAVE_TIME_CANNOT_BE_HONORED;
      break;
    default:
      value = SAVE_TIME_CANNOT_BE_HONORED;
      break;
    }
  }

  void readSaveStatus(SaveStatus& value)
  {
    switch (readUInt32Compressed()) {
    case 0:
      value = NO_SAVE_IN_PROGRESS;
      break;
    case 1:
      value = FEDERATE_INSTRUCTED_TO_SAVE;
      break;
    case 2:
      value = FEDERATE_SAVING;
      break;
    case 3:
      value = FEDERATE_WAITING_FOR_FEDERATION_TO_SAVE;
      break;
    default:
      value = FEDERATE_WAITING_FOR_FEDERATION_TO_SAVE;
      break;
    }
  }

  void readServiceGroupIndicator(ServiceGroupIndicator& value)
  {
    switch (readUInt32Compressed()) {
    case 0:
      value = FEDERATION_MANAGEMENT;
      break;
    case 1:
      value = DECLARATION_MANAGEMENT;
      break;
    case 2:
      value = OBJECT_MANAGEMENT;
      break;
    case 3:
      value = OWNERSHIP_MANAGEMENT;
      break;
    case 4:
      value = TIME_MANAGEMENT;
      break;
    case 5:
      value = DATA_DISTRIBUTION_MANAGEMENT;
      break;
    case 6:
      value = SUPPORT_SERVICES;
      break;
    default:
      value = SUPPORT_SERVICES;
      break;
    }
  }

  void readLowerBoundTimeStampCommitType(LowerBoundTimeStampCommitType& value)
  {
    switch (readUInt32Compressed()) {
    case 0:
      value = TimeAdvanceCommit;
      break;
    case 1:
      value = NextMessageCommit;
      break;
    case 2:
      value = TimeAdvanceAndNextMessageCommit;
      break;
    default:
      value = TimeAdvanceAndNextMessageCommit;
      break;
    }
  }

  void readSwitchesType(SwitchesType& value)
  {
    switch (readUInt32Compressed()) {
    case 0:
      value = InteractionRelevanceAdvisorySwitchesType;
      break;
    case 1:
      value = ObjectClassRelevanceAdvisorySwitchesType;
      break;
    case 2:
      value = AttributeRelevanceAdvisorySwitchesType;
      break;
    case 3:
      value = AttributeScopeAdvisorySwitchesType;
      break;
    case 4:
      value = AutoProvideSwitchesType;
      break;
    case 5:
      value = ConveyRegionDesignatorSetsSwitchesType;
      break;
    case 6:
      value = ServiceReportingSwitchesType;
      break;
    default:
      value = ServiceReportingSwitchesType;
      break;
    }
  }

  void readBool(bool& value)
  {
    value = readBoolCompressed();
  }

  void readString(std::string& value)
  {
    value.resize(readSizeTCompressed());
    for (std::string::iterator i = value.begin(); i != value.end(); ++i) {
      *i = readChar();
    }
  }

  void readUnsigned(uint32_t& value)
  {
    value = readUInt32Compressed();
  }

  void readDouble(double& value)
  {
    value = readFloat64Compressed();
  }

  void readFederationHandle(FederationHandle& value)
  {
    value = readUInt16Compressed();
  }

  void readModuleHandle(ModuleHandle& value)
  {
    value = readUInt16Compressed();
  }

  void readAttributeHandle(AttributeHandle& value)
  {
    value = readUInt32Compressed();
  }

  void readDimensionHandle(DimensionHandle& value)
  {
    value = readUInt32Compressed();
  }

  void readUpdateRateHandle(UpdateRateHandle& value)
  {
    value = readUInt32Compressed();
  }

  void readObjectClassHandle(ObjectClassHandle& value)
  {
    value = readUInt32Compressed();
  }

  void readObjectInstanceHandle(ObjectInstanceHandle& value)
  {
    value = readUInt32Compressed();
  }

  void readInteractionClassHandle(InteractionClassHandle& value)
  {
    value = readUInt32Compressed();
  }

  void readParameterHandle(ParameterHandle& value)
  {
    value = readUInt32Compressed();
  }

  void readFederateHandle(FederateHandle& value)
  {
    value = readUInt32Compressed();
  }

  void readSpaceHandle(SpaceHandle& value)
  {
    value = readUInt32Compressed();
  }

  void readTransportationHandle(TransportationHandle& value)
  {
    value = readUInt8Compressed();
  }

  void readOrderingHandle(OrderingHandle& value)
  {
    value = readUInt8Compressed();
  }

  void readMessageRetractionHandle(MessageRetractionHandle& value)
  {
    value = readUInt64Compressed();
  }

  void readRegionHandle(RegionHandle& value)
  {
    value = readUInt64Compressed();
  }

  void readAttributeHandleVector(AttributeHandleVector& value)
  {
    value.resize(readSizeTCompressed());
    for (AttributeHandleVector::iterator i = value.begin(); i != value.end(); ++i) {
      readAttributeHandle(*i);
    }
  }

  void readFederateHandleVector(FederateHandleVector& value)
  {
    value.resize(readSizeTCompressed());
    for (FederateHandleVector::iterator i = value.begin(); i != value.end(); ++i) {
      readFederateHandle(*i);
    }
  }

  void readParameterHandleVector(ParameterHandleVector& value)
  {
    value.resize(readSizeTCompressed());
    for (ParameterHandleVector::iterator i = value.begin(); i != value.end(); ++i) {
      readParameterHandle(*i);
    }
  }

  void readDimensionHandleVector(DimensionHandleVector& value)
  {
    value.resize(readSizeTCompressed());
    for (DimensionHandleVector::iterator i = value.begin(); i != value.end(); ++i) {
      readDimensionHandle(*i);
    }
  }

  void readDimensionHandleSet(DimensionHandleSet& value)
  {
    size_t size = readSizeTCompressed();
    for (; size != 0; --size) {
      DimensionHandle scalar;
      readDimensionHandle(scalar);
      value.insert(scalar);
    }
  }

  void readObjectInstanceHandleVector(ObjectInstanceHandleVector& value)
  {
    value.resize(readSizeTCompressed());
    for (ObjectInstanceHandleVector::iterator i = value.begin(); i != value.end(); ++i) {
      readObjectInstanceHandle(*i);
    }
  }

  void readRegionHandleVector(RegionHandleVector& value)
  {
    value.resize(readSizeTCompressed());
    for (RegionHandleVector::iterator i = value.begin(); i != value.end(); ++i) {
      readRegionHandle(*i);
    }
  }

  void readModuleHandleVector(ModuleHandleVector& value)
  {
    value.resize(readSizeTCompressed());
    for (ModuleHandleVector::iterator i = value.begin(); i != value.end(); ++i) {
      readModuleHandle(*i);
    }
  }

  void readStringVector(StringVector& value)
  {
    value.resize(readSizeTCompressed());
    for (StringVector::iterator i = value.begin(); i != value.end(); ++i) {
      readString(*i);
    }
  }

  void readStringSet(StringSet& value)
  {
    size_t size = readSizeTCompressed();
    for (; size != 0; --size) {
      String scalar;
      readString(scalar);
      value.insert(scalar);
    }
  }

  void readVariableLengthData(VariableLengthData& value)
  {
    size_t size = readSizeTCompressed();
    value.resize(size);
    if (size)
      _messageEncoding.addReadBuffer(size);
  }

  void readFederateHandleBoolPair(FederateHandleBoolPair& value)
  {
    readFederateHandle(value.first);
    readBool(value.second);
  }

  void readFederateHandleBoolPairVector(FederateHandleBoolPairVector& value)
  {
    value.resize(readSizeTCompressed());
    for (FederateHandleBoolPairVector::iterator i = value.begin(); i != value.end(); ++i) {
      readFederateHandleBoolPair(*i);
    }
  }

  void readRangeBoundsValue(RangeBoundsValue& value)
  {
    readUnsigned(value.getLowerBound());
    readUnsigned(value.getUpperBound());
  }

  void readDimensionHandleRangeBoundsValuePair(DimensionHandleRangeBoundsValuePair& value)
  {
    readDimensionHandle(value.first);
    readRangeBoundsValue(value.second);
  }

  void readRegionValue(RegionValue& value)
  {
    value.resize(readSizeTCompressed());
    for (RegionValue::iterator i = value.begin(); i != value.end(); ++i) {
      readDimensionHandleRangeBoundsValuePair(*i);
    }
  }

  void readRegionValueList(RegionValueList& value)
  {
    value.resize(readSizeTCompressed());
    for (RegionValueList::iterator i = value.begin(); i != value.end(); ++i) {
      readRegionValue(*i);
    }
  }

  void readRegionHandleDimensionHandleSetPair(RegionHandleDimensionHandleSetPair& value)
  {
    readRegionHandle(value.first);
    readDimensionHandleSet(value.second);
  }

  void readRegionHandleDimensionHandleSetPairVector(RegionHandleDimensionHandleSetPairVector& value)
  {
    value.resize(readSizeTCompressed());
    for (RegionHandleDimensionHandleSetPairVector::iterator i = value.begin(); i != value.end(); ++i) {
      readRegionHandleDimensionHandleSetPair(*i);
    }
  }

  void readRegionHandleSpaceHandlePair(RegionHandleSpaceHandlePair& value)
  {
    readRegionHandle(value.first);
    readSpaceHandle(value.second);
  }

  void readRegionHandleSpaceHandlePairVector(RegionHandleSpaceHandlePairVector& value)
  {
    value.resize(readSizeTCompressed());
    for (RegionHandleSpaceHandlePairVector::iterator i = value.begin(); i != value.end(); ++i) {
      readRegionHandleSpaceHandlePair(*i);
    }
  }

  void readRegionHandleRegionValuePair(RegionHandleRegionValuePair& value)
  {
    readRegionHandle(value.first);
    readRegionValue(value.second);
  }

  void readRegionHandleRegionValuePairVector(RegionHandleRegionValuePairVector& value)
  {
    value.resize(readSizeTCompressed());
    for (RegionHandleRegionValuePairVector::iterator i = value.begin(); i != value.end(); ++i) {
      readRegionHandleRegionValuePair(*i);
    }
  }

  void readInteractionClassHandleRegionValueListPair(InteractionClassHandleRegionValueListPair& value)
  {
    readInteractionClassHandle(value.first);
    readRegionValueList(value.second);
  }

  void readAttributeHandleRegionValueListPair(AttributeHandleRegionValueListPair& value)
  {
    readAttributeHandle(value.first);
    readRegionValueList(value.second);
  }

  void readAttributeState(AttributeState& value)
  {
    readAttributeHandle(value.getAttributeHandle());
  }

  void readAttributeStateVector(AttributeStateVector& value)
  {
    value.resize(readSizeTCompressed());
    for (AttributeStateVector::iterator i = value.begin(); i != value.end(); ++i) {
      readAttributeState(*i);
    }
  }

  void readParameterValue(ParameterValue& value)
  {
    readParameterHandle(value.getParameterHandle());
    readVariableLengthData(value.getValue());
  }

  void readParameterValueVector(ParameterValueVector& value)
  {
    value.resize(readSizeTCompressed());
    for (ParameterValueVector::iterator i = value.begin(); i != value.end(); ++i) {
      readParameterValue(*i);
    }
  }

  void readAttributeValue(AttributeValue& value)
  {
    readAttributeHandle(value.getAttributeHandle());
    readVariableLengthData(value.getValue());
  }

  void readAttributeValueVector(AttributeValueVector& value)
  {
    value.resize(readSizeTCompressed());
    for (AttributeValueVector::iterator i = value.begin(); i != value.end(); ++i) {
      readAttributeValue(*i);
    }
  }

  void readFederateHandleSaveStatusPair(FederateHandleSaveStatusPair& value)
  {
    readFederateHandle(value.first);
    readSaveStatus(value.second);
  }

  void readFederateHandleSaveStatusPairVector(FederateHandleSaveStatusPairVector& value)
  {
    value.resize(readSizeTCompressed());
    for (FederateHandleSaveStatusPairVector::iterator i = value.begin(); i != value.end(); ++i) {
      readFederateHandleSaveStatusPair(*i);
    }
  }

  void readFederateHandleRestoreStatusPair(FederateHandleRestoreStatusPair& value)
  {
    readFederateHandle(value.first);
    readRestoreStatus(value.second);
  }

  void readFederateHandleRestoreStatusPairVector(FederateHandleRestoreStatusPairVector& value)
  {
    value.resize(readSizeTCompressed());
    for (FederateHandleRestoreStatusPairVector::iterator i = value.begin(); i != value.end(); ++i) {
      readFederateHandleRestoreStatusPair(*i);
    }
  }

  void readFederationExecutionInformation(FederationExecutionInformation& value)
  {
    readString(value.getFederationExecutionName());
    readString(value.getLogicalTimeFactoryName());
  }

  void readFederationExecutionInformationVector(FederationExecutionInformationVector& value)
  {
    value.resize(readSizeTCompressed());
    for (FederationExecutionInformationVector::iterator i = value.begin(); i != value.end(); ++i) {
      readFederationExecutionInformation(*i);
    }
  }

  void readObjectInstanceHandleNamePair(ObjectInstanceHandleNamePair& value)
  {
    readObjectInstanceHandle(value.first);
    readString(value.second);
  }

  void readObjectInstanceHandleNamePairVector(ObjectInstanceHandleNamePairVector& value)
  {
    value.resize(readSizeTCompressed());
    for (ObjectInstanceHandleNamePairVector::iterator i = value.begin(); i != value.end(); ++i) {
      readObjectInstanceHandleNamePair(*i);
    }
  }

  void readCreateFederationExecutionResponseType(CreateFederationExecutionResponseType& value)
  {
    switch (readUInt32Compressed()) {
    case 0:
      value = CreateFederationExecutionResponseSuccess;
      break;
    case 1:
      value = CreateFederationExecutionResponseFederationExecutionAlreadyExists;
      break;
    case 2:
      value = CreateFederationExecutionResponseCouldNotOpenFDD;
      break;
    case 3:
      value = CreateFederationExecutionResponseErrorReadingFDD;
      break;
    case 4:
      value = CreateFederationExecutionResponseCouldNotCreateLogicalTimeFactory;
      break;
    case 5:
      value = CreateFederationExecutionResponseInconsistentFDD;
      break;
    case 6:
      value = CreateFederationExecutionResponseRTIinternalError;
      break;
    default:
      value = CreateFederationExecutionResponseRTIinternalError;
      break;
    }
  }

  void readDestroyFederationExecutionResponseType(DestroyFederationExecutionResponseType& value)
  {
    switch (readUInt32Compressed()) {
    case 0:
      value = DestroyFederationExecutionResponseSuccess;
      break;
    case 1:
      value = DestroyFederationExecutionResponseFederatesCurrentlyJoined;
      break;
    case 2:
      value = DestroyFederationExecutionResponseFederationExecutionDoesNotExist;
      break;
    case 3:
      value = DestroyFederationExecutionResponseRTIinternalError;
      break;
    default:
      value = DestroyFederationExecutionResponseRTIinternalError;
      break;
    }
  }

  void readJoinFederationExecutionResponseType(JoinFederationExecutionResponseType& value)
  {
    switch (readUInt32Compressed()) {
    case 0:
      value = JoinFederationExecutionResponseSuccess;
      break;
    case 1:
      value = JoinFederationExecutionResponseFederateNameAlreadyInUse;
      break;
    case 2:
      value = JoinFederationExecutionResponseFederationExecutionDoesNotExist;
      break;
    case 3:
      value = JoinFederationExecutionResponseSaveInProgress;
      break;
    case 4:
      value = JoinFederationExecutionResponseRestoreInProgress;
      break;
    case 5:
      value = JoinFederationExecutionResponseInconsistentFDD;
      break;
    default:
      value = JoinFederationExecutionResponseInconsistentFDD;
      break;
    }
  }

  void readRegisterFederationSynchronizationPointResponseType(RegisterFederationSynchronizationPointResponseType& value)
  {
    switch (readUInt32Compressed()) {
    case 0:
      value = RegisterFederationSynchronizationPointResponseSuccess;
      break;
    case 1:
      value = RegisterFederationSynchronizationPointResponseLabelNotUnique;
      break;
    case 2:
      value = RegisterFederationSynchronizationPointResponseMemberNotJoined;
      break;
    default:
      value = RegisterFederationSynchronizationPointResponseMemberNotJoined;
      break;
    }
  }

  void readConfigurationParameterMap(ConfigurationParameterMap& value)
  {
    size_t size = readSizeTCompressed();
    for (; size != 0; --size) {
      String key;
      readString(key);
      readStringVector(value[key]);
    }
  }

  void readFOMStringTransportationType(FOMStringTransportationType& value)
  {
    readString(value.getName());
  }

  void readFOMStringTransportationTypeList(FOMStringTransportationTypeList& value)
  {
    value.resize(readSizeTCompressed());
    for (FOMStringTransportationTypeList::iterator i = value.begin(); i != value.end(); ++i) {
      readFOMStringTransportationType(*i);
    }
  }

  void readFOMStringDimension(FOMStringDimension& value)
  {
    readString(value.getName());
    readUnsigned(value.getUpperBound());
  }

  void readFOMStringDimensionList(FOMStringDimensionList& value)
  {
    value.resize(readSizeTCompressed());
    for (FOMStringDimensionList::iterator i = value.begin(); i != value.end(); ++i) {
      readFOMStringDimension(*i);
    }
  }

  void readFOMStringRoutingSpace(FOMStringRoutingSpace& value)
  {
    readString(value.getName());
    readStringSet(value.getDimensionSet());
  }

  void readFOMStringRoutingSpaceList(FOMStringRoutingSpaceList& value)
  {
    value.resize(readSizeTCompressed());
    for (FOMStringRoutingSpaceList::iterator i = value.begin(); i != value.end(); ++i) {
      readFOMStringRoutingSpace(*i);
    }
  }

  void readFOMStringParameter(FOMStringParameter& value)
  {
    readString(value.getName());
  }

  void readFOMStringParameterList(FOMStringParameterList& value)
  {
    value.resize(readSizeTCompressed());
    for (FOMStringParameterList::iterator i = value.begin(); i != value.end(); ++i) {
      readFOMStringParameter(*i);
    }
  }

  void readFOMStringInteractionClass(FOMStringInteractionClass& value)
  {
    readStringVector(value.getName());
    readString(value.getOrderType());
    readString(value.getTransportationType());
    readString(value.getRoutingSpace());
    readStringSet(value.getDimensionSet());
    readFOMStringParameterList(value.getParameterList());
  }

  void readFOMStringInteractionClassList(FOMStringInteractionClassList& value)
  {
    value.resize(readSizeTCompressed());
    for (FOMStringInteractionClassList::iterator i = value.begin(); i != value.end(); ++i) {
      readFOMStringInteractionClass(*i);
    }
  }

  void readFOMStringAttribute(FOMStringAttribute& value)
  {
    readString(value.getName());
    readString(value.getOrderType());
    readString(value.getTransportationType());
    readString(value.getRoutingSpace());
    readStringSet(value.getDimensionSet());
  }

  void readFOMStringAttributeList(FOMStringAttributeList& value)
  {
    value.resize(readSizeTCompressed());
    for (FOMStringAttributeList::iterator i = value.begin(); i != value.end(); ++i) {
      readFOMStringAttribute(*i);
    }
  }

  void readFOMStringObjectClass(FOMStringObjectClass& value)
  {
    readStringVector(value.getName());
    readFOMStringAttributeList(value.getAttributeList());
  }

  void readFOMStringObjectClassList(FOMStringObjectClassList& value)
  {
    value.resize(readSizeTCompressed());
    for (FOMStringObjectClassList::iterator i = value.begin(); i != value.end(); ++i) {
      readFOMStringObjectClass(*i);
    }
  }

  void readFOMStringUpdateRate(FOMStringUpdateRate& value)
  {
    readString(value.getName());
    readDouble(value.getRate());
  }

  void readFOMStringUpdateRateList(FOMStringUpdateRateList& value)
  {
    value.resize(readSizeTCompressed());
    for (FOMStringUpdateRateList::iterator i = value.begin(); i != value.end(); ++i) {
      readFOMStringUpdateRate(*i);
    }
  }

  void readFOMStringSwitch(FOMStringSwitch& value)
  {
    readSwitchesType(value.getSwitchesType());
    readBool(value.getEnabled());
  }

  void readFOMStringSwitchList(FOMStringSwitchList& value)
  {
    value.resize(readSizeTCompressed());
    for (FOMStringSwitchList::iterator i = value.begin(); i != value.end(); ++i) {
      readFOMStringSwitch(*i);
    }
  }

  void readFOMStringModule(FOMStringModule& value)
  {
    readString(value.getContent());
    readFOMStringTransportationTypeList(value.getTransportationTypeList());
    readFOMStringDimensionList(value.getDimensionList());
    readFOMStringRoutingSpaceList(value.getRoutingSpaceList());
    readFOMStringInteractionClassList(value.getInteractionClassList());
    readFOMStringObjectClassList(value.getObjectClassList());
    readFOMStringUpdateRateList(value.getUpdateRateList());
    readFOMStringSwitchList(value.getSwitchList());
    readBool(value.getArtificialInteractionRoot());
    readBool(value.getArtificialObjectRoot());
  }

  void readFOMStringModuleList(FOMStringModuleList& value)
  {
    value.resize(readSizeTCompressed());
    for (FOMStringModuleList::iterator i = value.begin(); i != value.end(); ++i) {
      readFOMStringModule(*i);
    }
  }

  void readFOMTransportationType(FOMTransportationType& value)
  {
    readString(value.getName());
    readTransportationType(value.getTransportationType());
  }

  void readFOMTransportationTypeList(FOMTransportationTypeList& value)
  {
    value.resize(readSizeTCompressed());
    for (FOMTransportationTypeList::iterator i = value.begin(); i != value.end(); ++i) {
      readFOMTransportationType(*i);
    }
  }

  void readFOMDimension(FOMDimension& value)
  {
    readString(value.getName());
    readDimensionHandle(value.getDimensionHandle());
    readUnsigned(value.getUpperBound());
  }

  void readFOMDimensionList(FOMDimensionList& value)
  {
    value.resize(readSizeTCompressed());
    for (FOMDimensionList::iterator i = value.begin(); i != value.end(); ++i) {
      readFOMDimension(*i);
    }
  }

  void readFOMRoutingSpace(FOMRoutingSpace& value)
  {
    readString(value.getName());
    readSpaceHandle(value.getSpaceHandle());
    readDimensionHandleSet(value.getDimensionHandleSet());
  }

  void readFOMRoutingSpaceList(FOMRoutingSpaceList& value)
  {
    value.resize(readSizeTCompressed());
    for (FOMRoutingSpaceList::iterator i = value.begin(); i != value.end(); ++i) {
      readFOMRoutingSpace(*i);
    }
  }

  void readFOMParameter(FOMParameter& value)
  {
    readString(value.getName());
    readParameterHandle(value.getParameterHandle());
  }

  void readFOMParameterList(FOMParameterList& value)
  {
    value.resize(readSizeTCompressed());
    for (FOMParameterList::iterator i = value.begin(); i != value.end(); ++i) {
      readFOMParameter(*i);
    }
  }

  void readFOMInteractionClass(FOMInteractionClass& value)
  {
    readString(value.getName());
    readInteractionClassHandle(value.getInteractionClassHandle());
    readInteractionClassHandle(value.getParentInteractionClassHandle());
    readOrderType(value.getOrderType());
    readTransportationType(value.getTransportationType());
    readDimensionHandleSet(value.getDimensionHandleSet());
    readFOMParameterList(value.getParameterList());
  }

  void readFOMInteractionClassList(FOMInteractionClassList& value)
  {
    value.resize(readSizeTCompressed());
    for (FOMInteractionClassList::iterator i = value.begin(); i != value.end(); ++i) {
      readFOMInteractionClass(*i);
    }
  }

  void readFOMAttribute(FOMAttribute& value)
  {
    readString(value.getName());
    readAttributeHandle(value.getAttributeHandle());
    readOrderType(value.getOrderType());
    readTransportationType(value.getTransportationType());
    readDimensionHandleSet(value.getDimensionHandleSet());
  }

  void readFOMAttributeList(FOMAttributeList& value)
  {
    value.resize(readSizeTCompressed());
    for (FOMAttributeList::iterator i = value.begin(); i != value.end(); ++i) {
      readFOMAttribute(*i);
    }
  }

  void readFOMObjectClass(FOMObjectClass& value)
  {
    readString(value.getName());
    readObjectClassHandle(value.getObjectClassHandle());
    readObjectClassHandle(value.getParentObjectClassHandle());
    readFOMAttributeList(value.getAttributeList());
  }

  void readFOMObjectClassList(FOMObjectClassList& value)
  {
    value.resize(readSizeTCompressed());
    for (FOMObjectClassList::iterator i = value.begin(); i != value.end(); ++i) {
      readFOMObjectClass(*i);
    }
  }

  void readFOMUpdateRate(FOMUpdateRate& value)
  {
    readString(value.getName());
    readUpdateRateHandle(value.getUpdateRateHandle());
    readDouble(value.getRate());
  }

  void readFOMUpdateRateList(FOMUpdateRateList& value)
  {
    value.resize(readSizeTCompressed());
    for (FOMUpdateRateList::iterator i = value.begin(); i != value.end(); ++i) {
      readFOMUpdateRate(*i);
    }
  }

  void readFOMSwitch(FOMSwitch& value)
  {
    readSwitchesType(value.getSwitchesType());
    readBool(value.getEnabled());
  }

  void readFOMSwitchList(FOMSwitchList& value)
  {
    value.resize(readSizeTCompressed());
    for (FOMSwitchList::iterator i = value.begin(); i != value.end(); ++i) {
      readFOMSwitch(*i);
    }
  }

  void readFOMModule(FOMModule& value)
  {
    readModuleHandle(value.getModuleHandle());
    readFOMTransportationTypeList(value.getTransportationTypeList());
    readFOMDimensionList(value.getDimensionList());
    readFOMRoutingSpaceList(value.getRoutingSpaceList());
    readFOMInteractionClassList(value.getInteractionClassList());
    readFOMObjectClassList(value.getObjectClassList());
    readFOMUpdateRateList(value.getUpdateRateList());
    readFOMSwitchList(value.getSwitchList());
    readBool(value.getArtificialInteractionRoot());
    readBool(value.getArtificialObjectRoot());
    readString(value.getContent());
  }

  void readFOMModuleList(FOMModuleList& value)
  {
    value.resize(readSizeTCompressed());
    for (FOMModuleList::iterator i = value.begin(); i != value.end(); ++i) {
      readFOMModule(*i);
    }
  }

  void readConnectionLostMessage(ConnectionLostMessage& value)
  {
    readString(value.getFaultDescription());
  }

  void readCreateFederationExecutionRequestMessage(CreateFederationExecutionRequestMessage& value)
  {
    readString(value.getFederationExecution());
    readString(value.getLogicalTimeFactoryName());
    readFOMStringModuleList(value.getFOMStringModuleList());
  }

  void readCreateFederationExecutionResponseMessage(CreateFederationExecutionResponseMessage& value)
  {
    readCreateFederationExecutionResponseType(value.getCreateFederationExecutionResponseType());
    readString(value.getExceptionString());
  }

  void readDestroyFederationExecutionRequestMessage(DestroyFederationExecutionRequestMessage& value)
  {
    readString(value.getFederationExecution());
  }

  void readDestroyFederationExecutionResponseMessage(DestroyFederationExecutionResponseMessage& value)
  {
    readDestroyFederationExecutionResponseType(value.getDestroyFederationExecutionResponseType());
  }

  void readEnumerateFederationExecutionsRequestMessage(EnumerateFederationExecutionsRequestMessage& value)
  {
  }

  void readEnumerateFederationExecutionsResponseMessage(EnumerateFederationExecutionsResponseMessage& value)
  {
    readFederationExecutionInformationVector(value.getFederationExecutionInformationVector());
  }

  void readInsertFederationExecutionMessage(InsertFederationExecutionMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readString(value.getFederationName());
    readString(value.getLogicalTimeFactoryName());
    readConfigurationParameterMap(value.getConfigurationParameterMap());
  }

  void readShutdownFederationExecutionMessage(ShutdownFederationExecutionMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
  }

  void readEraseFederationExecutionMessage(EraseFederationExecutionMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
  }

  void readReleaseFederationHandleMessage(ReleaseFederationHandleMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
  }

  void readInsertModulesMessage(InsertModulesMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFOMModuleList(value.getFOMModuleList());
  }

  void readJoinFederationExecutionRequestMessage(JoinFederationExecutionRequestMessage& value)
  {
    readString(value.getFederationExecution());
    readString(value.getFederateType());
    readString(value.getFederateName());
    readFOMStringModuleList(value.getFOMStringModuleList());
    readConfigurationParameterMap(value.getConfigurationParameterMap());
  }

  void readJoinFederationExecutionResponseMessage(JoinFederationExecutionResponseMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readJoinFederationExecutionResponseType(value.getJoinFederationExecutionResponseType());
    readString(value.getExceptionString());
    readFederateHandle(value.getFederateHandle());
    readString(value.getFederateType());
    readString(value.getFederateName());
  }

  void readResignFederationExecutionLeafRequestMessage(ResignFederationExecutionLeafRequestMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getFederateHandle());
    readResignAction(value.getResignAction());
  }

  void readResignFederationExecutionRequestMessage(ResignFederationExecutionRequestMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getFederateHandle());
  }

  void readJoinFederateNotifyMessage(JoinFederateNotifyMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getFederateHandle());
    readString(value.getFederateType());
    readString(value.getFederateName());
  }

  void readResignFederateNotifyMessage(ResignFederateNotifyMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getFederateHandle());
  }

  void readChangeAutomaticResignDirectiveMessage(ChangeAutomaticResignDirectiveMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getFederateHandle());
    readResignAction(value.getResignAction());
  }

  void readRegisterFederationSynchronizationPointMessage(RegisterFederationSynchronizationPointMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getFederateHandle());
    readString(value.getLabel());
    readVariableLengthData(value.getTag());
    readFederateHandleVector(value.getFederateHandleVector());
  }

  void readRegisterFederationSynchronizationPointResponseMessage(RegisterFederationSynchronizationPointResponseMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getFederateHandle());
    readString(value.getLabel());
    readRegisterFederationSynchronizationPointResponseType(value.getRegisterFederationSynchronizationPointResponseType());
  }

  void readAnnounceSynchronizationPointMessage(AnnounceSynchronizationPointMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readString(value.getLabel());
    readVariableLengthData(value.getTag());
    readBool(value.getAddJoiningFederates());
    readFederateHandleVector(value.getFederateHandleVector());
  }

  void readSynchronizationPointAchievedMessage(SynchronizationPointAchievedMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readString(value.getLabel());
    readFederateHandleBoolPairVector(value.getFederateHandleBoolPairVector());
  }

  void readFederationSynchronizedMessage(FederationSynchronizedMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readString(value.getLabel());
    readFederateHandleBoolPairVector(value.getFederateHandleBoolPairVector());
  }

  void readEnableTimeRegulationRequestMessage(EnableTimeRegulationRequestMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getFederateHandle());
    readVariableLengthData(value.getTimeStamp());
    readUnsigned(value.getCommitId());
  }

  void readEnableTimeRegulationResponseMessage(EnableTimeRegulationResponseMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getFederateHandle());
    readFederateHandle(value.getRespondingFederateHandle());
    readBool(value.getTimeStampValid());
    readVariableLengthData(value.getTimeStamp());
  }

  void readDisableTimeRegulationRequestMessage(DisableTimeRegulationRequestMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getFederateHandle());
  }

  void readCommitLowerBoundTimeStampMessage(CommitLowerBoundTimeStampMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getFederateHandle());
    readVariableLengthData(value.getTimeStamp());
    readLowerBoundTimeStampCommitType(value.getCommitType());
    readUnsigned(value.getCommitId());
  }

  void readCommitLowerBoundTimeStampResponseMessage(CommitLowerBoundTimeStampResponseMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getFederateHandle());
    readFederateHandle(value.getSendingFederateHandle());
    readUnsigned(value.getCommitId());
  }

  void readLockedByNextMessageRequestMessage(LockedByNextMessageRequestMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getSendingFederateHandle());
    readBool(value.getLockedByNextMessage());
  }

  void readTimeConstrainedEnabledMessage(TimeConstrainedEnabledMessage& value)
  {
  }

  void readTimeRegulationEnabledMessage(TimeRegulationEnabledMessage& value)
  {
  }

  void readTimeAdvanceGrantedMessage(TimeAdvanceGrantedMessage& value)
  {
  }

  void readInsertRegionMessage(InsertRegionMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readRegionHandleDimensionHandleSetPairVector(value.getRegionHandleDimensionHandleSetPairVector());
  }

  void readCommitRegionMessage(CommitRegionMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readRegionHandleRegionValuePairVector(value.getRegionHandleRegionValuePairVector());
  }

  void readEraseRegionMessage(EraseRegionMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readRegionHandleVector(value.getRegionHandleVector());
  }

  void readChangeInteractionClassPublicationMessage(ChangeInteractionClassPublicationMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readPublicationType(value.getPublicationType());
    readInteractionClassHandle(value.getInteractionClassHandle());
  }

  void readChangeObjectClassPublicationMessage(ChangeObjectClassPublicationMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readPublicationType(value.getPublicationType());
    readObjectClassHandle(value.getObjectClassHandle());
    readAttributeHandleVector(value.getAttributeHandles());
  }

  void readChangeInteractionClassSubscriptionMessage(ChangeInteractionClassSubscriptionMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readSubscriptionType(value.getSubscriptionType());
    readInteractionClassHandle(value.getInteractionClassHandle());
  }

  void readChangeObjectClassSubscriptionMessage(ChangeObjectClassSubscriptionMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readSubscriptionType(value.getSubscriptionType());
    readObjectClassHandle(value.getObjectClassHandle());
    readAttributeHandleVector(value.getAttributeHandles());
  }

  void readRegistrationForObjectClassMessage(RegistrationForObjectClassMessage& value)
  {
    readObjectClassHandle(value.getObjectClassHandle());
    readBool(value.getStart());
  }

  void readAttributesInScopeMessage(AttributesInScopeMessage& value)
  {
    readObjectInstanceHandle(value.getObjectInstanceHandle());
    readAttributeHandleVector(value.getAttributeHandles());
    readBool(value.getInScope());
  }

  void readTurnUpdatesOnForInstanceMessage(TurnUpdatesOnForInstanceMessage& value)
  {
    readObjectInstanceHandle(value.getObjectInstanceHandle());
    readAttributeHandleVector(value.getAttributeHandles());
    readString(value.getUpdateRate());
    readBool(value.getOn());
  }

  void readTurnInteractionsOnMessage(TurnInteractionsOnMessage& value)
  {
    readInteractionClassHandle(value.getInteractionClassHandle());
    readBool(value.getOn());
  }

  void readInteractionMessage(InteractionMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getFederateHandle());
    readInteractionClassHandle(value.getInteractionClassHandle());
    readTransportationType(value.getTransportationType());
    readVariableLengthData(value.getTag());
    readParameterValueVector(value.getParameterValues());
  }

  void readTimeStampedInteractionMessage(TimeStampedInteractionMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getFederateHandle());
    readInteractionClassHandle(value.getInteractionClassHandle());
    readOrderType(value.getOrderType());
    readTransportationType(value.getTransportationType());
    readVariableLengthData(value.getTag());
    readVariableLengthData(value.getTimeStamp());
    readMessageRetractionHandle(value.getMessageRetractionHandle());
    readParameterValueVector(value.getParameterValues());
  }

  void readObjectInstanceHandlesRequestMessage(ObjectInstanceHandlesRequestMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getFederateHandle());
    readUnsigned(value.getCount());
  }

  void readObjectInstanceHandlesResponseMessage(ObjectInstanceHandlesResponseMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getFederateHandle());
    readObjectInstanceHandleNamePairVector(value.getObjectInstanceHandleNamePairVector());
  }

  void readReleaseMultipleObjectInstanceNameHandlePairsMessage(ReleaseMultipleObjectInstanceNameHandlePairsMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readObjectInstanceHandleVector(value.getObjectInstanceHandleVector());
  }

  void readReserveObjectInstanceNameRequestMessage(ReserveObjectInstanceNameRequestMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getFederateHandle());
    readString(value.getName());
  }

  void readReserveObjectInstanceNameResponseMessage(ReserveObjectInstanceNameResponseMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getFederateHandle());
    readObjectInstanceHandleNamePair(value.getObjectInstanceHandleNamePair());
    readBool(value.getSuccess());
  }

  void readReserveMultipleObjectInstanceNameRequestMessage(ReserveMultipleObjectInstanceNameRequestMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getFederateHandle());
    readStringVector(value.getNameList());
  }

  void readReserveMultipleObjectInstanceNameResponseMessage(ReserveMultipleObjectInstanceNameResponseMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getFederateHandle());
    readObjectInstanceHandleNamePairVector(value.getObjectInstanceHandleNamePairVector());
    readBool(value.getSuccess());
  }

  void readInsertObjectInstanceMessage(InsertObjectInstanceMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readObjectClassHandle(value.getObjectClassHandle());
    readObjectInstanceHandle(value.getObjectInstanceHandle());
    readString(value.getName());
    readAttributeStateVector(value.getAttributeStateVector());
  }

  void readDeleteObjectInstanceMessage(DeleteObjectInstanceMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getFederateHandle());
    readObjectInstanceHandle(value.getObjectInstanceHandle());
    readVariableLengthData(value.getTag());
  }

  void readTimeStampedDeleteObjectInstanceMessage(TimeStampedDeleteObjectInstanceMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getFederateHandle());
    readObjectInstanceHandle(value.getObjectInstanceHandle());
    readOrderType(value.getOrderType());
    readVariableLengthData(value.getTag());
    readVariableLengthData(value.getTimeStamp());
    readMessageRetractionHandle(value.getMessageRetractionHandle());
  }

  void readAttributeUpdateMessage(AttributeUpdateMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getFederateHandle());
    readObjectInstanceHandle(value.getObjectInstanceHandle());
    readVariableLengthData(value.getTag());
    readTransportationType(value.getTransportationType());
    readAttributeValueVector(value.getAttributeValues());
  }

  void readTimeStampedAttributeUpdateMessage(TimeStampedAttributeUpdateMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readFederateHandle(value.getFederateHandle());
    readObjectInstanceHandle(value.getObjectInstanceHandle());
    readVariableLengthData(value.getTag());
    readVariableLengthData(value.getTimeStamp());
    readMessageRetractionHandle(value.getMessageRetractionHandle());
    readOrderType(value.getOrderType());
    readTransportationType(value.getTransportationType());
    readAttributeValueVector(value.getAttributeValues());
  }

  void readRequestAttributeUpdateMessage(RequestAttributeUpdateMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readObjectInstanceHandle(value.getObjectInstanceHandle());
    readAttributeHandleVector(value.getAttributeHandles());
    readVariableLengthData(value.getTag());
  }

  void readRequestClassAttributeUpdateMessage(RequestClassAttributeUpdateMessage& value)
  {
    readFederationHandle(value.getFederationHandle());
    readObjectClassHandle(value.getObjectClassHandle());
    readAttributeHandleVector(value.getAttributeHandles());
    readVariableLengthData(value.getTag());
  }

private:
  TightBE1MessageEncoding& _messageEncoding;
};

class OPENRTI_LOCAL TightBE1MessageEncoding::PayloadDecoder {
public:
  PayloadDecoder(const Buffer::const_iterator& i) :
    _i(i)
  { }
  void readPayloadVariableLengthData(VariableLengthData& value)
  {
    if (!value.size())
      return;
    value = *_i;
    ++_i;
  }

  void readPayloadParameterValue(ParameterValue& value)
  {
    readPayloadVariableLengthData(value.getValue());
  }

  void readPayloadParameterValueVector(ParameterValueVector& value)
  {
    for (ParameterValueVector::iterator i = value.begin(); i != value.end(); ++i) {
      readPayloadParameterValue(*i);
    }
  }

  void readPayloadAttributeValue(AttributeValue& value)
  {
    readPayloadVariableLengthData(value.getValue());
  }

  void readPayloadAttributeValueVector(AttributeValueVector& value)
  {
    for (AttributeValueVector::iterator i = value.begin(); i != value.end(); ++i) {
      readPayloadAttributeValue(*i);
    }
  }

  void readPayloadRegisterFederationSynchronizationPointMessage(RegisterFederationSynchronizationPointMessage& value)
  {
    readPayloadVariableLengthData(value.getTag());
  }

  void readPayloadAnnounceSynchronizationPointMessage(AnnounceSynchronizationPointMessage& value)
  {
    readPayloadVariableLengthData(value.getTag());
  }

  void readPayloadEnableTimeRegulationRequestMessage(EnableTimeRegulationRequestMessage& value)
  {
    readPayloadVariableLengthData(value.getTimeStamp());
  }

  void readPayloadEnableTimeRegulationResponseMessage(EnableTimeRegulationResponseMessage& value)
  {
    readPayloadVariableLengthData(value.getTimeStamp());
  }

  void readPayloadCommitLowerBoundTimeStampMessage(CommitLowerBoundTimeStampMessage& value)
  {
    readPayloadVariableLengthData(value.getTimeStamp());
  }

  void readPayloadInteractionMessage(InteractionMessage& value)
  {
    readPayloadVariableLengthData(value.getTag());
    readPayloadParameterValueVector(value.getParameterValues());
  }

  void readPayloadTimeStampedInteractionMessage(TimeStampedInteractionMessage& value)
  {
    readPayloadVariableLengthData(value.getTag());
    readPayloadVariableLengthData(value.getTimeStamp());
    readPayloadParameterValueVector(value.getParameterValues());
  }

  void readPayloadDeleteObjectInstanceMessage(DeleteObjectInstanceMessage& value)
  {
    readPayloadVariableLengthData(value.getTag());
  }

  void readPayloadTimeStampedDeleteObjectInstanceMessage(TimeStampedDeleteObjectInstanceMessage& value)
  {
    readPayloadVariableLengthData(value.getTag());
    readPayloadVariableLengthData(value.getTimeStamp());
  }

  void readPayloadAttributeUpdateMessage(AttributeUpdateMessage& value)
  {
    readPayloadVariableLengthData(value.getTag());
    readPayloadAttributeValueVector(value.getAttributeValues());
  }

  void readPayloadTimeStampedAttributeUpdateMessage(TimeStampedAttributeUpdateMessage& value)
  {
    readPayloadVariableLengthData(value.getTag());
    readPayloadVariableLengthData(value.getTimeStamp());
    readPayloadAttributeValueVector(value.getAttributeValues());
  }

  void readPayloadRequestAttributeUpdateMessage(RequestAttributeUpdateMessage& value)
  {
    readPayloadVariableLengthData(value.getTag());
  }

  void readPayloadRequestClassAttributeUpdateMessage(RequestClassAttributeUpdateMessage& value)
  {
    readPayloadVariableLengthData(value.getTag());
  }

  Buffer::const_iterator _i;
};

TightBE1MessageEncoding::TightBE1MessageEncoding()
{
}

TightBE1MessageEncoding::~TightBE1MessageEncoding()
{
}

const char*
TightBE1MessageEncoding::getName() const
{
  return "TightBE1";
}

void
TightBE1MessageEncoding::readPacket(const Buffer& buffer)
{
  Buffer::const_iterator i = buffer.begin();
  if (i == buffer.end()) {
    addScratchReadBuffer(4);
  } else if (++i == buffer.end()) {
    addScratchReadBuffer(buffer.front().getUInt32BE(0));
  } else if (++i == buffer.end()) {
    decodeBody(*(--i));
  } else {
    decodePayload(i);
  }
  if (getInputBufferComplete())
    getConnect()->send(SharedPtr<AbstractMessage>().swap(_message));
}

void
TightBE1MessageEncoding::decodeBody(const VariableLengthData& variableLengthData)
{
  DecodeStream decodeStream(variableLengthData, *this);
  uint16_t opcode = decodeStream.readUInt16Compressed();
  switch (opcode) {
  case 1:
    _message = new ConnectionLostMessage;
    decodeStream.readConnectionLostMessage(static_cast<ConnectionLostMessage&>(*_message));
    break;
  case 2:
    _message = new CreateFederationExecutionRequestMessage;
    decodeStream.readCreateFederationExecutionRequestMessage(static_cast<CreateFederationExecutionRequestMessage&>(*_message));
    break;
  case 3:
    _message = new CreateFederationExecutionResponseMessage;
    decodeStream.readCreateFederationExecutionResponseMessage(static_cast<CreateFederationExecutionResponseMessage&>(*_message));
    break;
  case 4:
    _message = new DestroyFederationExecutionRequestMessage;
    decodeStream.readDestroyFederationExecutionRequestMessage(static_cast<DestroyFederationExecutionRequestMessage&>(*_message));
    break;
  case 5:
    _message = new DestroyFederationExecutionResponseMessage;
    decodeStream.readDestroyFederationExecutionResponseMessage(static_cast<DestroyFederationExecutionResponseMessage&>(*_message));
    break;
  case 6:
    _message = new EnumerateFederationExecutionsRequestMessage;
    decodeStream.readEnumerateFederationExecutionsRequestMessage(static_cast<EnumerateFederationExecutionsRequestMessage&>(*_message));
    break;
  case 7:
    _message = new EnumerateFederationExecutionsResponseMessage;
    decodeStream.readEnumerateFederationExecutionsResponseMessage(static_cast<EnumerateFederationExecutionsResponseMessage&>(*_message));
    break;
  case 8:
    _message = new InsertFederationExecutionMessage;
    decodeStream.readInsertFederationExecutionMessage(static_cast<InsertFederationExecutionMessage&>(*_message));
    break;
  case 9:
    _message = new ShutdownFederationExecutionMessage;
    decodeStream.readShutdownFederationExecutionMessage(static_cast<ShutdownFederationExecutionMessage&>(*_message));
    break;
  case 10:
    _message = new EraseFederationExecutionMessage;
    decodeStream.readEraseFederationExecutionMessage(static_cast<EraseFederationExecutionMessage&>(*_message));
    break;
  case 11:
    _message = new ReleaseFederationHandleMessage;
    decodeStream.readReleaseFederationHandleMessage(static_cast<ReleaseFederationHandleMessage&>(*_message));
    break;
  case 12:
    _message = new InsertModulesMessage;
    decodeStream.readInsertModulesMessage(static_cast<InsertModulesMessage&>(*_message));
    break;
  case 13:
    _message = new JoinFederationExecutionRequestMessage;
    decodeStream.readJoinFederationExecutionRequestMessage(static_cast<JoinFederationExecutionRequestMessage&>(*_message));
    break;
  case 14:
    _message = new JoinFederationExecutionResponseMessage;
    decodeStream.readJoinFederationExecutionResponseMessage(static_cast<JoinFederationExecutionResponseMessage&>(*_message));
    break;
  case 15:
    _message = new ResignFederationExecutionRequestMessage;
    decodeStream.readResignFederationExecutionRequestMessage(static_cast<ResignFederationExecutionRequestMessage&>(*_message));
    break;
  case 16:
    _message = new JoinFederateNotifyMessage;
    decodeStream.readJoinFederateNotifyMessage(static_cast<JoinFederateNotifyMessage&>(*_message));
    break;
  case 17:
    _message = new ResignFederateNotifyMessage;
    decodeStream.readResignFederateNotifyMessage(static_cast<ResignFederateNotifyMessage&>(*_message));
    break;
  case 18:
    _message = new ChangeAutomaticResignDirectiveMessage;
    decodeStream.readChangeAutomaticResignDirectiveMessage(static_cast<ChangeAutomaticResignDirectiveMessage&>(*_message));
    break;
  case 30:
    _message = new RegisterFederationSynchronizationPointMessage;
    decodeStream.readRegisterFederationSynchronizationPointMessage(static_cast<RegisterFederationSynchronizationPointMessage&>(*_message));
    break;
  case 31:
    _message = new RegisterFederationSynchronizationPointResponseMessage;
    decodeStream.readRegisterFederationSynchronizationPointResponseMessage(static_cast<RegisterFederationSynchronizationPointResponseMessage&>(*_message));
    break;
  case 32:
    _message = new AnnounceSynchronizationPointMessage;
    decodeStream.readAnnounceSynchronizationPointMessage(static_cast<AnnounceSynchronizationPointMessage&>(*_message));
    break;
  case 33:
    _message = new SynchronizationPointAchievedMessage;
    decodeStream.readSynchronizationPointAchievedMessage(static_cast<SynchronizationPointAchievedMessage&>(*_message));
    break;
  case 34:
    _message = new FederationSynchronizedMessage;
    decodeStream.readFederationSynchronizedMessage(static_cast<FederationSynchronizedMessage&>(*_message));
    break;
  case 40:
    _message = new EnableTimeRegulationRequestMessage;
    decodeStream.readEnableTimeRegulationRequestMessage(static_cast<EnableTimeRegulationRequestMessage&>(*_message));
    break;
  case 41:
    _message = new EnableTimeRegulationResponseMessage;
    decodeStream.readEnableTimeRegulationResponseMessage(static_cast<EnableTimeRegulationResponseMessage&>(*_message));
    break;
  case 42:
    _message = new DisableTimeRegulationRequestMessage;
    decodeStream.readDisableTimeRegulationRequestMessage(static_cast<DisableTimeRegulationRequestMessage&>(*_message));
    break;
  case 43:
    _message = new CommitLowerBoundTimeStampMessage;
    decodeStream.readCommitLowerBoundTimeStampMessage(static_cast<CommitLowerBoundTimeStampMessage&>(*_message));
    break;
  case 44:
    _message = new CommitLowerBoundTimeStampResponseMessage;
    decodeStream.readCommitLowerBoundTimeStampResponseMessage(static_cast<CommitLowerBoundTimeStampResponseMessage&>(*_message));
    break;
  case 45:
    _message = new LockedByNextMessageRequestMessage;
    decodeStream.readLockedByNextMessageRequestMessage(static_cast<LockedByNextMessageRequestMessage&>(*_message));
    break;
  case 46:
    _message = new InsertRegionMessage;
    decodeStream.readInsertRegionMessage(static_cast<InsertRegionMessage&>(*_message));
    break;
  case 47:
    _message = new CommitRegionMessage;
    decodeStream.readCommitRegionMessage(static_cast<CommitRegionMessage&>(*_message));
    break;
  case 48:
    _message = new EraseRegionMessage;
    decodeStream.readEraseRegionMessage(static_cast<EraseRegionMessage&>(*_message));
    break;
  case 50:
    _message = new ChangeInteractionClassPublicationMessage;
    decodeStream.readChangeInteractionClassPublicationMessage(static_cast<ChangeInteractionClassPublicationMessage&>(*_message));
    break;
  case 51:
    _message = new ChangeObjectClassPublicationMessage;
    decodeStream.readChangeObjectClassPublicationMessage(static_cast<ChangeObjectClassPublicationMessage&>(*_message));
    break;
  case 52:
    _message = new ChangeInteractionClassSubscriptionMessage;
    decodeStream.readChangeInteractionClassSubscriptionMessage(static_cast<ChangeInteractionClassSubscriptionMessage&>(*_message));
    break;
  case 53:
    _message = new ChangeObjectClassSubscriptionMessage;
    decodeStream.readChangeObjectClassSubscriptionMessage(static_cast<ChangeObjectClassSubscriptionMessage&>(*_message));
    break;
  case 80:
    _message = new InteractionMessage;
    decodeStream.readInteractionMessage(static_cast<InteractionMessage&>(*_message));
    break;
  case 81:
    _message = new TimeStampedInteractionMessage;
    decodeStream.readTimeStampedInteractionMessage(static_cast<TimeStampedInteractionMessage&>(*_message));
    break;
  case 60:
    _message = new ObjectInstanceHandlesRequestMessage;
    decodeStream.readObjectInstanceHandlesRequestMessage(static_cast<ObjectInstanceHandlesRequestMessage&>(*_message));
    break;
  case 61:
    _message = new ObjectInstanceHandlesResponseMessage;
    decodeStream.readObjectInstanceHandlesResponseMessage(static_cast<ObjectInstanceHandlesResponseMessage&>(*_message));
    break;
  case 62:
    _message = new ReleaseMultipleObjectInstanceNameHandlePairsMessage;
    decodeStream.readReleaseMultipleObjectInstanceNameHandlePairsMessage(static_cast<ReleaseMultipleObjectInstanceNameHandlePairsMessage&>(*_message));
    break;
  case 63:
    _message = new ReserveObjectInstanceNameRequestMessage;
    decodeStream.readReserveObjectInstanceNameRequestMessage(static_cast<ReserveObjectInstanceNameRequestMessage&>(*_message));
    break;
  case 64:
    _message = new ReserveObjectInstanceNameResponseMessage;
    decodeStream.readReserveObjectInstanceNameResponseMessage(static_cast<ReserveObjectInstanceNameResponseMessage&>(*_message));
    break;
  case 65:
    _message = new ReserveMultipleObjectInstanceNameRequestMessage;
    decodeStream.readReserveMultipleObjectInstanceNameRequestMessage(static_cast<ReserveMultipleObjectInstanceNameRequestMessage&>(*_message));
    break;
  case 66:
    _message = new ReserveMultipleObjectInstanceNameResponseMessage;
    decodeStream.readReserveMultipleObjectInstanceNameResponseMessage(static_cast<ReserveMultipleObjectInstanceNameResponseMessage&>(*_message));
    break;
  case 90:
    _message = new InsertObjectInstanceMessage;
    decodeStream.readInsertObjectInstanceMessage(static_cast<InsertObjectInstanceMessage&>(*_message));
    break;
  case 91:
    _message = new DeleteObjectInstanceMessage;
    decodeStream.readDeleteObjectInstanceMessage(static_cast<DeleteObjectInstanceMessage&>(*_message));
    break;
  case 92:
    _message = new TimeStampedDeleteObjectInstanceMessage;
    decodeStream.readTimeStampedDeleteObjectInstanceMessage(static_cast<TimeStampedDeleteObjectInstanceMessage&>(*_message));
    break;
  case 94:
    _message = new AttributeUpdateMessage;
    decodeStream.readAttributeUpdateMessage(static_cast<AttributeUpdateMessage&>(*_message));
    break;
  case 96:
    _message = new TimeStampedAttributeUpdateMessage;
    decodeStream.readTimeStampedAttributeUpdateMessage(static_cast<TimeStampedAttributeUpdateMessage&>(*_message));
    break;
  case 97:
    _message = new RequestAttributeUpdateMessage;
    decodeStream.readRequestAttributeUpdateMessage(static_cast<RequestAttributeUpdateMessage&>(*_message));
    break;
  case 98:
    _message = new RequestClassAttributeUpdateMessage;
    decodeStream.readRequestClassAttributeUpdateMessage(static_cast<RequestClassAttributeUpdateMessage&>(*_message));
    break;
  default:
    break;
  }
};

void
TightBE1MessageEncoding::decodePayload(const Buffer::const_iterator& i)
{
  Buffer::const_iterator j = i;
  DecodeDataStream decodeStream(*(--j));
  uint16_t opcode = decodeStream.readUInt16Compressed();
  PayloadDecoder payloadDecoder(i);
  switch (opcode) {
  case 30:
    payloadDecoder.readPayloadRegisterFederationSynchronizationPointMessage(static_cast<RegisterFederationSynchronizationPointMessage&>(*_message));
    break;
  case 32:
    payloadDecoder.readPayloadAnnounceSynchronizationPointMessage(static_cast<AnnounceSynchronizationPointMessage&>(*_message));
    break;
  case 40:
    payloadDecoder.readPayloadEnableTimeRegulationRequestMessage(static_cast<EnableTimeRegulationRequestMessage&>(*_message));
    break;
  case 41:
    payloadDecoder.readPayloadEnableTimeRegulationResponseMessage(static_cast<EnableTimeRegulationResponseMessage&>(*_message));
    break;
  case 43:
    payloadDecoder.readPayloadCommitLowerBoundTimeStampMessage(static_cast<CommitLowerBoundTimeStampMessage&>(*_message));
    break;
  case 80:
    payloadDecoder.readPayloadInteractionMessage(static_cast<InteractionMessage&>(*_message));
    break;
  case 81:
    payloadDecoder.readPayloadTimeStampedInteractionMessage(static_cast<TimeStampedInteractionMessage&>(*_message));
    break;
  case 91:
    payloadDecoder.readPayloadDeleteObjectInstanceMessage(static_cast<DeleteObjectInstanceMessage&>(*_message));
    break;
  case 92:
    payloadDecoder.readPayloadTimeStampedDeleteObjectInstanceMessage(static_cast<TimeStampedDeleteObjectInstanceMessage&>(*_message));
    break;
  case 94:
    payloadDecoder.readPayloadAttributeUpdateMessage(static_cast<AttributeUpdateMessage&>(*_message));
    break;
  case 96:
    payloadDecoder.readPayloadTimeStampedAttributeUpdateMessage(static_cast<TimeStampedAttributeUpdateMessage&>(*_message));
    break;
  case 97:
    payloadDecoder.readPayloadRequestAttributeUpdateMessage(static_cast<RequestAttributeUpdateMessage&>(*_message));
    break;
  case 98:
    payloadDecoder.readPayloadRequestClassAttributeUpdateMessage(static_cast<RequestClassAttributeUpdateMessage&>(*_message));
    break;
  default:
    break;
  }
}

void
TightBE1MessageEncoding::writeMessage(const AbstractMessage& message)
{
  message.dispatchFunctor(DispatchFunctor(*this));
}

} // namespace OpenRTI

